Compare commits

...
20 Commits
Author SHA1 Message Date
internal-nix-ci[bot] d340f188c6 Merge pull request #15342 from NixOS/backport-15341-to-2.32-maintenance
[Backport 2.32-maintenance] Fix the nix-community/patsh/0.2.1 flake regression test (again)
2026-02-26 00:14:00 +00:00
Eelco Dolstra 3c23b8170c Fix the nix-community/patsh/0.2.1 flake regression test (again)
(cherry picked from commit 2334977863)
2026-02-25 23:39:53 +00:00
Sergei Zimmerman 5968add551 Bump version 2026-02-25 14:27:40 +03:00
Sergei Zimmerman 8dce03d1bf Merge pull request #15260 from obsidiansystems/backport-15252-to-2.32-maintenance
[Backport 2.32-maintenance] upload-release: disable containerd image store to preserve gzip layer compression
2026-02-17 02:23:28 +03:00
Amaan Qureshi e08987ac51 upload-release: disable containerd image store to preserve gzip layer compression
(cherry picked from commit 2ccb8a9a56)
2026-02-16 17:52:27 -05:00
internal-nix-ci[bot] ebd7b8f6ed Merge pull request #15165 from NixOS/backport-15160-to-2.32-maintenance
[Backport 2.32-maintenance] builtins.flakeRefToString: Evaluate attributes
2026-02-06 19:30:14 +00:00
Eelco Dolstra afc4aced62 builtins.flakeRefToString: Evaluate attributes
Fixes "attribute 'x' is a thunk".

(cherry picked from commit 2989a23fca)
2026-02-06 18:59:56 +00:00
internal-nix-ci[bot] 59209bf9ba Merge pull request #15139 from NixOS/backport-15134-to-2.32-maintenance
[Backport 2.32-maintenance] Fix: `QueryPathInfo` throws on invalid path error in daemon
2026-02-03 23:11:24 +00:00
Peter Bynum aa9553503d Fix QueryPathInfo in daemon
(cherry picked from commit b9c77ecafc)
2026-02-03 22:19:23 +00:00
John Ericson 989f7a3f12 Merge pull request #15087 from NixOS/backport-15078-to-2.32-maintenance
[Backport 2.33-maintenance] Fix destruction of DerivationBuilder implementations
2026-01-26 16:20:59 -05:00
Sergei Zimmerman 3ca2ce200f Fix destruction of DerivationBuilder implementations
This unsures that we call the correct virtual functions when destroying a particular
DerivationBuilder.

Usually the order of destructors is in the reverse order of inheritance:

ChrootLinuxDerivationBuilder -> ChrootDerivationBuilder -> DerivationBuilderImpl

autoDelChroot was being destroyed before the DerivationBuilderImpl::killChild was
run and it would fail to clean up the chroot directory, since there were still processes
writing to it. Note that ChrootLinuxDerivationBuilder::killSandbox was never run in
the interrupted case at all, since virtual functions in destructors do not call derived class
methods.

I could reproduce the issue with the following derivation:

let
  pkgs = import <nixpkgs> { };
in
pkgs.runCommand "chroot-cleanup-race" { } ''
  mkdir -p $out

  for i in $(seq 1 200); do
    (
      mkfifo $out/fifo$i
      cat $out/fifo$i > /dev/null &

      while true; do
        : > $out/file$i
      done
    ) &
  done

  sleep 0.05
  echo done > $out/main
''

While interrupting it manually when it would hang.

Wrapping the unique pointer in a custom deleter function we can run all
of the necessary clean up code consistently and calling the right virtual
functions. Ideally we'd have a lint that bans the usage of virtual functions
in destructors completely.

(cherry picked from commit b752c5cb64)
(cherry picked from commit 70ecd8c8a9)
2026-01-26 14:45:48 -05:00
internal-nix-ci[bot] c3687f4f95 Merge pull request #15066 from NixOS/backport-15062-to-2.32-maintenance
[Backport 2.32-maintenance] ci: Drop magic-nix-cache
2026-01-23 01:08:10 +00:00
Sergei Zimmerman 278d8e58d2 ci: Drop magic-nix-cache
We are now seeing. I guess we are out with the cache. When the API responds with 418 (I'm a teapot)
it seems like the only reasonable solution is to oblige.

error: unable to download 'http://127.0.0.1:37515/7ms9f25xyxavf32pvdc3vb28nzzmkbn3.narinfo': HTTP error 418
       response body:
       GitHub API error: GitHub Actions Cache throttled Magic Nix Cache. Not trying to use it again on this run.
(cherry picked from commit dae41e06e8)
2026-01-23 00:35:21 +00:00
internal-nix-ci[bot] 9713638cda Merge pull request #15035 from NixOS/backport-15031-to-2.32-maintenance
[Backport 2.32-maintenance] ci: Bump magic-nix-cache to disable on 429
2026-01-21 05:23:03 +00:00
Sergei Zimmerman f170bb7b41 ci: Bump magic-nix-cache to disable on 429
(cherry picked from commit 1555677cd5)
2026-01-21 04:50:15 +00:00
internal-nix-ci[bot] b601b44de5 Merge pull request #14976 from NixOS/backport-14961-to-2.32-maintenance
[Backport 2.32-maintenance] libutil/union-source-accessor: Barf on non-existent directories
2026-01-11 19:39:19 +00:00
Sergei Zimmerman 2a79b7765c libutil/union-source-accessor: Barf on non-existent directories
Previously builtins.readDir would return an empty attribute set
instead of barfing on non-existent paths. This is a regression from
2.32 for impure eval.

(cherry picked from commit 4ab2cdacfc)
2026-01-11 19:02:53 +00:00
internal-nix-ci[bot] 5a842aa155 Merge pull request #14943 from NixOS/backport-14778-to-2.32-maintenance
[Backport 2.32-maintenance] test: add shebangs to shell.nix test scripts
2026-01-07 14:23:00 +00:00
Agustín Covarrubias 803eaf9ef3 test: add shebangs to shell.nix test scripts
Fix intermittent SIGSEGV (exit code 139) on macOS when running
  nix-shell and shebang tests inside the nix sandbox.

  The foo, bar, and ruby test scripts were created without shebangs,
  which causes intermittent crashes when executed via command
  substitution on macOS. Adding proper shebangs resolves the flakiness.

  Potentially closes: #13106

(cherry picked from commit 7b3d7eb634)
2026-01-07 13:50:17 +00:00
Sergei Zimmerman 394a8da9dd Bump version 2026-01-02 18:17:09 +03:00
23 changed files with 150 additions and 29 deletions

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
+11
View File
@@ -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:
+1 -1
View File
@@ -1 +1 @@
2.32.5
2.32.7
+3
View File
@@ -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)
+1
View File
@@ -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,
+4 -1
View File
@@ -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;
+25 -7
View File
@@ -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 {};
}
+4
View File
@@ -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
+6 -3
View File
@@ -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
'';