Repository navigation
Open
Labels
Description
Describe the bug
I've recently started seeing failures like this on the darwin builder:
error: builder for '/nix/store/z1q1rs77xzdakfbmnhfdln57sj2qfgvg-equal-contents-builddotnetmodule-produces-the-expected-output-when-called-with-a-recursive-function.drv' failed with exit code 1;
last 17 log lines:
> Checking:
> buildDotnetModule produces the expected output when called with a recursive function
> --- /nix/store/v56zw95ycr0j23azn05q4irrlp4w3zq1-dotnet-final-attrs-test-override-rec-output
> +++ /nix/store/g7wrgvsf205vvg4s0v1i66wffw3dav21-overridden-copyright.txt
> ├── stat {}
> │ @@ -1,7 +1,7 @@
> │
> │ Size: 33 Blocks: 8 IO Block: 4096 regular file
> │ -Device: 1,18 Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 0/ wheel)
> │ +Device: 1,18 Access: (0444/-r--r--r--) Uid: ( 0/ root) Gid: ( 350/ nixbld)
> │
> │ Modify: 1970-01-01 00:00:01.000000000 +0000
>
> Contents must be equal, but were not!
>
> +: expected, at /nix/store/g7wrgvsf205vvg4s0v1i66wffw3dav21-overridden-copyright.txt
> -: unexpected, at /nix/store/v56zw95ycr0j23azn05q4irrlp4w3zq1-dotnet-final-attrs-test-override-rec-output
For full logs, run:
nix log /nix/store/z1q1rs77xzdakfbmnhfdln57sj2qfgvg-equal-contents-builddotnetmodule-produces-the-expected-output-when-called-with-a-recursive-function.drv
I can't seem to reproduce a build that has a gid of nixbld. I'm thinking this must have been due to a configuration change?
This comes from testers.testEqualContents using diffoscope to compare things.
Steps To Reproduce
$ ls -l $(nix build --impure --expr '(import <nixpkgs> {}).writeText "test" "foo"' --print-out-paths --no-link)
-r--r--r-- 1 root wheel 3 Jan 1 1970 /nix/store/f2gld1snrpw6zsic8yfkb4a57hz725kv-test
$ ls -l $(nix build --expr 'builtins.toFile "test" "foo"' --print-out-paths --no-link)
-r--r--r-- 1 root nixbld 3 Jan 1 1970 /nix/store/1pp26hq9hc0hrk23qx8mq7mxfs0pj3h9-test
Expected behavior
I'm fairly certain this worked a couple of months ago, but I don't have root access on this machine, so I'm a little limited in how I can investigate.
Metadata
nix-env (Nix) 2.28.4
Additional context
$ ls -l /nix/
total 122576
-rwxr-xr-x 1 customer staff 62721680 Jan 3 2025 nix-installer
-rw-r--r-- 1 root wheel 33814 Jan 3 2025 receipt.json
drwxrwxr-t@ 65535 root nixbld 6422976 Aug 8 15:57 store
drwxr-xr-x@ 4 root wheel 128 Jan 3 2025 var
Checklist
- checked latest Nix manual (source)
- checked open bug issues and pull requests for possible duplicates
Add 👍 to issues you find important.
Reacted by Kenichi Kamiya and Simon Žlender
Activity
corngood commentedon Aug 9, 2025
After some more investigation I realised that it's possible I've never run this sort of test before on darwin. These particular tests were only recently exposed in a way that they would be run by
nixpkgs-review.Partially revert "tests: replace writeText with toFile"
xokdvium commentedon Oct 4, 2026
Huh ok, this issue is kinda annoying and stems from how group ownership differs between linux/macos.
Linux behaves pretty sanely and everything is owned by current uid/gid (or 0:0 in multi-user installs). But on macos we sometimes get
nixbldowner (when adding to the store, like via toFile) or we canonicalise to current uid/gid anyway (0:0 in multi-user installs). So we do need to align both code paths. The store directory is sticky, so group ownership isn't quite that big of an issue as one might think, but I'm not sure which of the 2 is better. Having everything be canonicalised to the uid/group of the store owner seems like a sane approach to me and would make it consistent with Linux at least, but I might be missing some important implications.packaging/scripted-installer: Only chown pre-existing files when needed
packaging/scripted-installer: Only chown pre-existing files when needed
packaging/scripted-installer: Only chown pre-existing files when needed
packaging/scripted-installer: Only chown pre-existing files when needed
packaging/scripted-installer: Only chown pre-existing files when needed
packaging/scripted-installer: Only chown pre-existing files when needed