Compare commits
20
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d340f188c6 | ||
|
|
3c23b8170c | ||
|
|
5968add551 | ||
|
|
8dce03d1bf | ||
|
|
e08987ac51 | ||
|
|
ebd7b8f6ed | ||
|
|
afc4aced62 | ||
|
|
59209bf9ba | ||
|
|
aa9553503d | ||
|
|
989f7a3f12 | ||
|
|
3ca2ce200f | ||
|
|
c3687f4f95 | ||
|
|
278d8e58d2 | ||
|
|
9713638cda | ||
|
|
f170bb7b41 | ||
|
|
b601b44de5 | ||
|
|
2a79b7765c | ||
|
|
5a842aa155 | ||
|
|
803eaf9ef3 | ||
|
|
394a8da9dd |
No files matched your search
@@ -24,8 +24,8 @@ inputs:
|
||||
description: "Github token"
|
||||
required: true
|
||||
use_cache:
|
||||
description: "Whether to setup magic-nix-cache"
|
||||
default: true
|
||||
description: "Whether to setup github actions cache (not implemented currently)"
|
||||
default: false
|
||||
required: false
|
||||
runs:
|
||||
using: "composite"
|
||||
@@ -122,10 +122,3 @@ runs:
|
||||
source-url: ${{ inputs.experimental-installer-version != 'latest' && 'https://artifacts.nixos.org/experimental-installer/tag/${{ inputs.experimental-installer-version }}/${{ env.EXPERIMENTAL_INSTALLER_ARTIFACT }}' || '' }}
|
||||
nix-package-url: ${{ inputs.dogfood == 'true' && steps.download-nix-installer.outputs.tarball-path || (inputs.tarball_url || '') }}
|
||||
extra-conf: ${{ inputs.extra_nix_config }}
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13
|
||||
if: ${{ inputs.use_cache == 'true' }}
|
||||
with:
|
||||
diagnostic-endpoint: ''
|
||||
use-flakehub: false
|
||||
use-gha-cache: true
|
||||
source-revision: 92d9581367be2233c2d5714a2640e1339f4087d8 # main
|
||||
@@ -39,6 +39,17 @@ jobs:
|
||||
role-to-assume: "arn:aws:iam::080433136561:role/nix-release"
|
||||
role-session-name: nix-release-oidc-${{ github.run_id }}
|
||||
aws-region: eu-west-1
|
||||
- name: Disable containerd image store
|
||||
run: |
|
||||
# Docker 28+ defaults to the containerd image store, which
|
||||
# pushes layers uncompressed instead of gzip. OCI clients
|
||||
# that only support gzip (e.g. go-containerregistry) fail
|
||||
# with "gzip: invalid header". Disabling the containerd
|
||||
# snapshotter restores the classic storage driver, which
|
||||
# preserves gzip-compressed layers through the
|
||||
# `docker load` / `docker push` pipeline.
|
||||
echo '{"features":{"containerd-snapshotter":false}}' | sudo tee /etc/docker/daemon.json > /dev/null
|
||||
sudo systemctl restart docker
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
|
||||
with:
|
||||
|
||||
@@ -237,6 +237,9 @@ void Input::checkLocks(Input specified, Input & result)
|
||||
if (auto prevNarHash = specified.getNarHash())
|
||||
specified.attrs.insert_or_assign("narHash", prevNarHash->to_string(HashFormat::SRI, true));
|
||||
|
||||
if (auto narHash = result.getNarHash())
|
||||
result.attrs.insert_or_assign("narHash", narHash->to_string(HashFormat::SRI, true));
|
||||
|
||||
for (auto & field : specified.attrs) {
|
||||
auto field2 = result.attrs.find(field.first);
|
||||
if (field2 != result.attrs.end() && field.second != field2->second)
|
||||
|
||||
@@ -102,6 +102,7 @@ static void prim_flakeRefToString(EvalState & state, const PosIdx pos, Value **
|
||||
state.forceAttrs(*args[0], noPos, "while evaluating the argument passed to builtins.flakeRefToString");
|
||||
fetchers::Attrs attrs;
|
||||
for (const auto & attr : *args[0]->attrs()) {
|
||||
state.forceValue(*attr.value, attr.pos);
|
||||
auto t = attr.value->type();
|
||||
if (t == nInt) {
|
||||
auto intValue = attr.value->integer().value;
|
||||
|
||||
@@ -717,8 +717,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
||||
{
|
||||
DerivationBuildingGoal & goal;
|
||||
|
||||
DerivationBuildingGoalCallbacks(
|
||||
DerivationBuildingGoal & goal, std::unique_ptr<DerivationBuilder> & builder)
|
||||
DerivationBuildingGoalCallbacks(DerivationBuildingGoal & goal)
|
||||
: goal{goal}
|
||||
{
|
||||
}
|
||||
@@ -775,7 +774,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
||||
already be created, so we don't need to create it again. */
|
||||
builder = makeDerivationBuilder(
|
||||
*localStoreP,
|
||||
std::make_unique<DerivationBuildingGoalCallbacks>(*this, builder),
|
||||
std::make_unique<DerivationBuildingGoalCallbacks>(*this),
|
||||
DerivationBuilderParams{
|
||||
.drvPath = drvPath,
|
||||
.buildResult = buildResult,
|
||||
|
||||
@@ -849,7 +849,10 @@ static void performOp(
|
||||
auto path = store->parseStorePath(readString(conn.from));
|
||||
std::shared_ptr<const ValidPathInfo> info;
|
||||
logger->startWork();
|
||||
info = store->queryPathInfo(path);
|
||||
try {
|
||||
info = store->queryPathInfo(path);
|
||||
} catch (InvalidPath &) {
|
||||
}
|
||||
logger->stopWork();
|
||||
if (info) {
|
||||
conn.to << 1;
|
||||
|
||||
@@ -179,8 +179,15 @@ struct DerivationBuilder : RestrictionContext
|
||||
virtual bool killChild() = 0;
|
||||
};
|
||||
|
||||
struct DerivationBuilderDeleter
|
||||
{
|
||||
void operator()(DerivationBuilder * builder) noexcept;
|
||||
};
|
||||
|
||||
using DerivationBuilderUnique = std::unique_ptr<DerivationBuilder, DerivationBuilderDeleter>;
|
||||
|
||||
#ifndef _WIN32 // TODO enable `DerivationBuilder` on Windows
|
||||
std::unique_ptr<DerivationBuilder> makeDerivationBuilder(
|
||||
DerivationBuilderUnique makeDerivationBuilder(
|
||||
LocalStore & store, std::unique_ptr<DerivationBuilderCallbacks> miscMethods, DerivationBuilderParams params);
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "nix/store/parsed-derivations.hh"
|
||||
#include "nix/store/derivation-options.hh"
|
||||
#include "nix/store/build/derivation-building-misc.hh"
|
||||
#include "nix/store/build/derivation-builder.hh"
|
||||
#include "nix/store/outputs-spec.hh"
|
||||
#include "nix/store/store-api.hh"
|
||||
#include "nix/store/pathlocks.hh"
|
||||
@@ -82,7 +83,7 @@ private:
|
||||
*/
|
||||
std::unique_ptr<HookInstance> hook;
|
||||
|
||||
std::unique_ptr<DerivationBuilder> builder;
|
||||
DerivationBuilderUnique builder;
|
||||
#endif
|
||||
|
||||
BuildMode buildMode;
|
||||
|
||||
@@ -92,10 +92,13 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
~DerivationBuilderImpl()
|
||||
/**
|
||||
* Cleanup code to run when destroying any DerivationBuilderImpl implementation.
|
||||
*/
|
||||
void cleanupOnDestruction() noexcept
|
||||
{
|
||||
/* Careful: we should never ever throw an exception from a
|
||||
destructor. */
|
||||
noexcept function. */
|
||||
try {
|
||||
killChild();
|
||||
} catch (...) {
|
||||
@@ -1915,7 +1918,20 @@ StorePath DerivationBuilderImpl::makeFallbackPath(const StorePath & path)
|
||||
|
||||
namespace nix {
|
||||
|
||||
std::unique_ptr<DerivationBuilder> makeDerivationBuilder(
|
||||
void DerivationBuilderDeleter::operator()(DerivationBuilder * builder) noexcept
|
||||
{
|
||||
if (!builder) /* Idempotent and handles nullptr as any deleter must. */
|
||||
return;
|
||||
|
||||
if (auto builderImpl = dynamic_cast<DerivationBuilderImpl *>(builder))
|
||||
/* Note that this might call into virtual functions, which we can't do in a destructor of
|
||||
the DerivationBuilderImpl itself. */
|
||||
builderImpl->cleanupOnDestruction();
|
||||
|
||||
delete builder;
|
||||
}
|
||||
|
||||
std::unique_ptr<DerivationBuilder, DerivationBuilderDeleter> makeDerivationBuilder(
|
||||
LocalStore & store, std::unique_ptr<DerivationBuilderCallbacks> miscMethods, DerivationBuilderParams params)
|
||||
{
|
||||
if (auto builder = ExternalDerivationBuilder::newIfSupported(store, miscMethods, params))
|
||||
@@ -1969,17 +1985,19 @@ std::unique_ptr<DerivationBuilder> makeDerivationBuilder(
|
||||
throw Error("feature 'uid-range' is only supported in sandboxed builds");
|
||||
|
||||
#ifdef __APPLE__
|
||||
return std::make_unique<DarwinDerivationBuilder>(store, std::move(miscMethods), std::move(params), useSandbox);
|
||||
return DerivationBuilderUnique(
|
||||
new DarwinDerivationBuilder(store, std::move(miscMethods), std::move(params), useSandbox));
|
||||
#elif defined(__linux__)
|
||||
if (useSandbox)
|
||||
return std::make_unique<ChrootLinuxDerivationBuilder>(store, std::move(miscMethods), std::move(params));
|
||||
return DerivationBuilderUnique(
|
||||
new ChrootLinuxDerivationBuilder(store, std::move(miscMethods), std::move(params)));
|
||||
|
||||
return std::make_unique<LinuxDerivationBuilder>(store, std::move(miscMethods), std::move(params));
|
||||
return DerivationBuilderUnique(new LinuxDerivationBuilder(store, std::move(miscMethods), std::move(params)));
|
||||
#else
|
||||
if (useSandbox)
|
||||
throw Error("sandboxing builds is not supported on this platform");
|
||||
|
||||
return std::make_unique<DerivationBuilderImpl>(store, std::move(miscMethods), std::move(params));
|
||||
return DerivationBuilderUnique(new DerivationBuilderImpl(store, std::move(miscMethods), std::move(params)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -15,14 +15,14 @@ struct ExternalDerivationBuilder : DerivationBuilderImpl
|
||||
experimentalFeatureSettings.require(Xp::ExternalBuilders);
|
||||
}
|
||||
|
||||
static std::unique_ptr<ExternalDerivationBuilder> newIfSupported(
|
||||
static std::unique_ptr<ExternalDerivationBuilder, DerivationBuilderDeleter> newIfSupported(
|
||||
LocalStore & store, std::unique_ptr<DerivationBuilderCallbacks> & miscMethods, DerivationBuilderParams & params)
|
||||
{
|
||||
for (auto & handler : settings.externalBuilders.get()) {
|
||||
for (auto & system : handler.systems)
|
||||
if (params.drv.platform == system)
|
||||
return std::make_unique<ExternalDerivationBuilder>(
|
||||
store, std::move(miscMethods), std::move(params), handler);
|
||||
return std::unique_ptr<ExternalDerivationBuilder, DerivationBuilderDeleter>(
|
||||
new ExternalDerivationBuilder(store, std::move(miscMethods), std::move(params), handler));
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -35,14 +35,18 @@ struct UnionSourceAccessor : SourceAccessor
|
||||
DirEntries readDirectory(const CanonPath & path) override
|
||||
{
|
||||
DirEntries result;
|
||||
bool exists = false;
|
||||
for (auto & accessor : accessors) {
|
||||
auto st = accessor->maybeLstat(path);
|
||||
if (!st)
|
||||
continue;
|
||||
exists = true;
|
||||
for (auto & entry : accessor->readDirectory(path))
|
||||
// Don't override entries from previous accessors.
|
||||
result.insert(entry);
|
||||
}
|
||||
if (!exists)
|
||||
throw FileNotFound("path '%s' does not exist", showPath(path));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
error:
|
||||
… while evaluating the attribute 'absolutePath'
|
||||
at /pwd/lang/eval-fail-readDir-nonexistent-1.nix:2:3:
|
||||
1| {
|
||||
2| absolutePath = builtins.readDir /this/path/really/should/not/exist;
|
||||
| ^
|
||||
3| }
|
||||
|
||||
… while calling the 'readDir' builtin
|
||||
at /pwd/lang/eval-fail-readDir-nonexistent-1.nix:2:18:
|
||||
1| {
|
||||
2| absolutePath = builtins.readDir /this/path/really/should/not/exist;
|
||||
| ^
|
||||
3| }
|
||||
|
||||
error: path '/this/path/really/should/not/exist' does not exist
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
absolutePath = builtins.readDir /this/path/really/should/not/exist;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
error:
|
||||
… while evaluating the attribute 'relativePath'
|
||||
at /pwd/lang/eval-fail-readDir-nonexistent-2.nix:2:3:
|
||||
1| {
|
||||
2| relativePath = builtins.readDir ./this/path/really/should/not/exist;
|
||||
| ^
|
||||
3| }
|
||||
|
||||
… while calling the 'readDir' builtin
|
||||
at /pwd/lang/eval-fail-readDir-nonexistent-2.nix:2:18:
|
||||
1| {
|
||||
2| relativePath = builtins.readDir ./this/path/really/should/not/exist;
|
||||
| ^
|
||||
3| }
|
||||
|
||||
error: path '/pwd/lang/this/path/really/should/not/exist' does not exist
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
relativePath = builtins.readDir ./this/path/really/should/not/exist;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
error:
|
||||
… while evaluating the attribute 'regularFile'
|
||||
at /pwd/lang/eval-fail-readDir-not-a-directory-1.nix:2:3:
|
||||
1| {
|
||||
2| regularFile = builtins.readDir ./readDir/bar;
|
||||
| ^
|
||||
3| }
|
||||
|
||||
… while calling the 'readDir' builtin
|
||||
at /pwd/lang/eval-fail-readDir-not-a-directory-1.nix:2:17:
|
||||
1| {
|
||||
2| regularFile = builtins.readDir ./readDir/bar;
|
||||
| ^
|
||||
3| }
|
||||
|
||||
error: cannot read directory "/pwd/lang/readDir/bar": Not a directory
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
regularFile = builtins.readDir ./readDir/bar;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
error:
|
||||
… while evaluating the attribute 'symlinkedRegularFile'
|
||||
at /pwd/lang/eval-fail-readDir-not-a-directory-2.nix:2:3:
|
||||
1| {
|
||||
2| symlinkedRegularFile = builtins.readDir ./readDir/linked;
|
||||
| ^
|
||||
3| }
|
||||
|
||||
… while calling the 'readDir' builtin
|
||||
at /pwd/lang/eval-fail-readDir-not-a-directory-2.nix:2:26:
|
||||
1| {
|
||||
2| symlinkedRegularFile = builtins.readDir ./readDir/linked;
|
||||
| ^
|
||||
3| }
|
||||
|
||||
error: cannot read directory "/pwd/lang/readDir/foo/git-hates-directories": Not a directory
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
symlinkedRegularFile = builtins.readDir ./readDir/linked;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ git-hates-directories = "regular"; }
|
||||
@@ -0,0 +1 @@
|
||||
builtins.readDir ./readDir/ldir
|
||||
@@ -96,14 +96,16 @@ let
|
||||
|
||||
foo = runCommand "foo" { } ''
|
||||
mkdir -p $out/bin
|
||||
echo 'echo ${fooContents}' > $out/bin/foo
|
||||
echo '#!${shell}' > $out/bin/foo
|
||||
echo 'echo ${fooContents}' >> $out/bin/foo
|
||||
chmod a+rx $out/bin/foo
|
||||
ln -s ${shell} $out/bin/bash
|
||||
'';
|
||||
|
||||
bar = runCommand "bar" { } ''
|
||||
mkdir -p $out/bin
|
||||
echo 'echo bar' > $out/bin/bar
|
||||
echo '#!${shell}' > $out/bin/bar
|
||||
echo 'echo bar' >> $out/bin/bar
|
||||
chmod a+rx $out/bin/bar
|
||||
'';
|
||||
|
||||
@@ -116,7 +118,8 @@ let
|
||||
# ruby "interpreter" that outputs "$@"
|
||||
ruby = runCommand "ruby" { } ''
|
||||
mkdir -p $out/bin
|
||||
echo 'printf %s "$*"' > $out/bin/ruby
|
||||
echo '#!${shell}' > $out/bin/ruby
|
||||
echo 'printf %s "$*"' >> $out/bin/ruby
|
||||
chmod a+rx $out/bin/ruby
|
||||
'';
|
||||
|
||||
|
||||
Reference in new issue
Block a user