Content-addressed Nix − call for testers

Let’s rebuild the world! Thanks for the great work, I’m excited to see the results of this. I did try a little bit yesterday and that all looked very good already, let’s see what happens trying to rebuild the whole system :).

1 Like

So far I have adjusted my nix.conf and therefore have to be considered a “visitor of the garden”, and now I can not enter a shell anymore:

$ nix shell nixpkgs/nixos-unstable#restic
warning: unknown setting 'gc-check-reachability'
error: cannot operate on an output of unbuilt content-addresed derivation 'sha256:8d495e4606c56834ecfabb56c4b6161f4559d40705fd1658b7bb7f1418933711!out'

And I even tried a nix build nixpkgs/nixos-unstable#restic but shell still complains about the CAD beeing unbuilt…

Are you sure your Nix is recent-enough? What you show seems to be an instance of `nix shell` fails with the `ca-derivations` experimental feature · Issue #4721 · NixOS/nix · GitHub which was fixed two weeks ago

Yes I am:

$ nix --version
warning: unknown setting 'gc-check-reachability'
nix (Nix) 2.4pre20210326_dd77f71

For me 2021-03-26 looks like beeing newer than 2021-03-04.

For me 2021-03-26 looks like beeing newer than 2021-03-04.

Duh I’m sorry, there was a typo in the post, it should have been the fourth of may, not march

Okay, then I’ll prepare my config to strictly use nix/master and will try again later.

This might take quite a while as I have to leave for the office now.

1 Like

I was able to figure this one out. That was related to my usage of flake utils flattenTree.

Now I only see that error when I try to build the config that actually has the mentioned config set…

Still waiting for nix-2.4pre20210504_fe3a10a getting built to try again with a newer version… That Laptop is not the quickest :smiley:

Nope, even with that version of nix…

When I try to build the system configuration, it fails:

$ nix build -L .\#nixosConfigurations.delly-nixos.config.system.build.toplevel --experimental-features "ca-derivations nix-command flakes"
warning: Git tree '/home/nmelzer/Projects/nixos-config' is dirty
error: experimental Nix feature 'ca-derivations' is disabled; use '--experimental-features ca-derivations' to override
(use '--show-trace' to show detailed location information)
$ nix --version
nix (Nix) 2.4pre20210504_fe3a10a

Did I perhaps fundamentally misunderstood how to enable the config.contentAddressedByDefault?

@teto I’m having this problem too and I haven’t activated content-addressed: Derivation does not have wanted outputs 'dev,out'

Has to be something in the environment of the toy box…

I can (start to) build its configuration from one of my other computers quite fine…

I will try to write up a bug report later today/tomorrow with relevant data.

Is that more suited to nixos/nix or nixos/nixpkgs?

Thanks, that’ll be quite helpful :slight_smile: nixos/nix is the place to go!

Created the issue, thanks so far

https://github.com/NixOS/nix/issues/4784

So I have good news and I have bad news.

The good news is that I got to build everything (I didn’t use the binary cache). I hit a flaky test (pyzmq off the top of my head), but after restarting the build those tests passed.

The bad news is that applying it resulted in a not-booting system. When normally the DE comes up (plasma5 in my case), there was just a cursor and nothing else happened anymore. I did get a bootloader and could select generations, but it didn’t fully boot through. Looking at journalctl -xe didn’t give anything obvious. I’ll look more closely at this later. Rebooting to an older generation, removing that one line and rebuilding fixed it, so I’m sure it’s something to do with the ca derivations.

I’m out of time for now, will look at this later and report back.

4 Likes

The patch seems to work :slight_smile:

2 Likes

I tried to rebuild the toy machines config on another host. After about 36 hours of building GCC 6.5 failed when rewriting hashes:

warning: rewriting hashes in '/nix/store/l33z0bmc7053wmfqs8gdaz0w1wbbn3i5-gcc-6.5.0.drv.chroot/nix/store/aqwfrnpm9fb851piyh565wjiyn9780wc-gcc-6.5.0-lib'; cross fingers
warning: rewriting hashes in '/nix/store/l33z0bmc7053wmfqs8gdaz0w1wbbn3i5-gcc-6.5.0.drv.chroot/nix/store/7fvj23l4ij9376nngk8mark7pnrhc795-gcc-6.5.0-man'; cross fingers
warning: rewriting hashes in '/nix/store/l33z0bmc7053wmfqs8gdaz0w1wbbn3i5-gcc-6.5.0.drv.chroot/nix/store/mgns4w4gk38gf4j71al18xzxaz27fnjl-gcc-6.5.0'; cross fingers
error: path '/nix/store/13xd1i6zhvxqca9mx7wh7yjrwz8xl3s8-gcc-6.5.0-lib' is not valid

After the build stopped with that error, the GC lock got released and the daily GC went rogue, deleting all the built stuff…

This ends the experiment of doing a full conversion on at least one of my systems for now until I manage to fix the problems on the toy machine.

Daily drivers will remain “Visitors of the garden” and perhaps I’ll also play around with __contentAddressed for some of my derivations.

I tried again today on darwin and I have an error coming

warning: rewriting hashes in '/nix/store/b461pnkhnkgd57kavbyyai05yx3bm28w-libxml2-2.9.10-man'; cross fingers
warning: rewriting hashes in '/nix/store/d0wi004b6s6xgaga1sv4i0nsc3slwbhz-libxml2-2.9.10-py'; cross fingers
error: builder for '/nix/store/452pmql7ba96xycn5abcmg211zdlnd8z-xnu-3789.70.16.drv' failed with exit code 2;
       last 10 log lines:
       > make[5]: Leaving directory '/private/tmp/nix-build-xnu-3789.70.16.drv-0/xnu-3789.70.16/BUILD/obj/DEVELOPMENT_X86_64/iokit/IOKit'
       > make[4]: *** [//private/tmp/nix-build-xnu-3789.70.16.drv-0/xnu-3789.70.16/makedefs/MakeInc.dir:64: build_installhdrs_mi] Error 2
       > make[4]: Leaving directory '/private/tmp/nix-build-xnu-3789.70.16.drv-0/xnu-3789.70.16/BUILD/obj/DEVELOPMENT_X86_64/iokit/IOKit'
       > make[3]: *** [//private/tmp/nix-build-xnu-3789.70.16.drv-0/xnu-3789.70.16/makedefs/MakeInc.dir:65: build_installhdrs_mi_recurse_into_IOKit] Error 2
       > make[3]: Leaving directory '/private/tmp/nix-build-xnu-3789.70.16.drv-0/xnu-3789.70.16/BUILD/obj/DEVELOPMENT_X86_64/iokit'
       > make[2]: *** [//private/tmp/nix-build-xnu-3789.70.16.drv-0/xnu-3789.70.16/makedefs/MakeInc.dir:65: build_installhdrs_mi_recurse_into_iokit] Error 2
       > make[2]: Leaving directory '/private/tmp/nix-build-xnu-3789.70.16.drv-0/xnu-3789.70.16/BUILD/obj/DEVELOPMENT_X86_64'
       > make[1]: *** [//private/tmp/nix-build-xnu-3789.70.16.drv-0/xnu-3789.70.16/makedefs/MakeInc.top:365: build_installhdrs_mi_bootstrap_DEVELOPMENT^X86_64^NONE] Error 2
       > make[1]: Leaving directory '/private/tmp/nix-build-xnu-3789.70.16.drv-0/xnu-3789.70.16'
       > make: *** [Makefile:190: installhdrs] Error 2
       For full logs, run 'nix log /nix/store/452pmql7ba96xycn5abcmg211zdlnd8z-xnu-3789.70.16.drv'.
error: 1 dependencies of derivation '/nix/store/sn4k1by5mgdfw7wzi9pyli98857zzvfk-Libsystem-1238.60.2.drv' failed to build
error: 1 dependencies of derivation '/nix/store/a52gh0lqa19rw5kxzw06g4rv30khykxi-binutils-wrapper-2.35.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/jf46vkzz6yz2z0g06fdgqy9i32vn9rr5-binutils-wrapper-2.35.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3f6m0abk2rp2z5f54flsq4x30kq4ydn0-bootstrap-stage0-clang-wrapper-7.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/fxl39qiq1j4kjnlvizc3wn5pagbl3fhw-bootstrap-stage0-clang-wrapper-7.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/lbaln88imn33n8cl069b5a12i4w6xdbv-bootstrap-stage0-clang-wrapper-7.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4hzdcfzp65r0yzziabhnbxwrkgz11vzv-bootstrap-stage2-stdenv-darwin.drv' failed to build
error: 1 dependencies of derivation '/nix/store/rgn90fbirgcwc9fyy0yymr08rh7cpc3b-bootstrap-stage2-stdenv-darwin.drv' failed to build
error: 1 dependencies of derivation '/nix/store/2b6gjjl1sf26156fwn8g105fzniid5m3-bootstrap-stage3-stdenv-darwin.drv' failed to build
error: 1 dependencies of derivation '/nix/store/d6j7fml7vwglklqfdc93y1c70h9d10na-bootstrap-stage3-stdenv-darwin.drv' failed to build
error: 1 dependencies of derivation '/nix/store/9c7m49aydxp690sykdgh793xn4x099bx-cctools-binutils-darwin-wrapper-949.0.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/lnvna4vlgwd7y0q5rp01jqkm4qxxkdjh-clang-wrapper-11.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/dj5zal15xmxv4wblwj4acchbbb20pc7f-clang-wrapper-6.0.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/d9gk0hmp1qhfv33d5nai8wb8mnczq11v-clang-wrapper-7.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hg29fd3147bqn4nc1vbk21xjniq7j99a-clang-wrapper-7.1.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/sp9hyl0brdjglf2kqrv22s4l7gvwlggw-cmake-3.19.7.drv' failed to build
error: 1 dependencies of derivation '/nix/store/xcai9lfp0w6mcnhkv5i1srxxg5vh2309-cmake-boot-3.19.7.drv' failed to build
error: 1 dependencies of derivation '/nix/store/cpfy3vcjxjysw3cvnf2qqzav9yamj0jz-gcc-10.2.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/18xf8by8cf7wjwgd8zzkikyj3lnx6grr-perl-5.32.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/k8i4vqaixzpn1sahaljl7nib47ria08d-perl-5.32.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/i2k5nsir7qj33ijjlk580mhw67r8lpwh-python-2.7.18.drv' failed to build
error: 1 dependencies of derivation '/nix/store/33j5y6fvvghcyqj7m8bfp0z4y2g44dqb-stdenv-darwin.drv' failed to build
error: 1 dependencies of derivation '/nix/store/nm1nxkfp7wlcc3y0176fnj7h2vn1ii28-stdenv-darwin.drv' failed to build
error: 1 dependencies of derivation '/nix/store/mzwiwwniqs8zgv400q2vw4r9yd143v40-darwin-system-21.05.20210507.1c16013+darwin4.a7492a8.drv' failed to build

Of course the system builds fine without contentAddressedByDefault

I tried rebuilding today for my desktop. I just set the nixpkgs config to enable content addressable globally. I know it builds correctly without the content addressable flag enabled globally. Here’s the error I’m running into with chromium:

error: hash mismatch in fixed-output derivation '/nix/store/c3p0s6sxkqpf66yz2nbd362mjpx3jg6w-rust-cbindgen-0.18.0-vendor.tar.gz.drv':
         specified: sha256-uaeJmGEQHVSuILlYlJOHmRWWdN6FPvrHu6CbJyb60MY=
            got:    sha256-gKf9sQuraF6zxBpyyvWseqQzrk/xD4OhsoGC0l5bm/k=
error: 1 dependencies of derivation '/nix/store/pl26dx07qrn8n2i20l65ii2x4mmhrb08-rust-cbindgen-0.18.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/j3vbn0jsc42haww6zwa5fkcr2r0d1nr3-spidermonkey-78.8.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/hw0plmi2x3fb5aidzdjymcrswbcclkp7-polkit-0.118.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ai8143rfmnb8cf6agc599c188679y7pb-gconf-3.2.6.drv' failed to build
error: 1 dependencies of derivation '/nix/store/3p84arha8qvvckndlpj64211g3jxv8a0-openjdk-8u272-b10.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ydwbyg6qwa4ccjm8n0rszlnkqf5qfn4a-chromium-unwrapped-90.0.4430.93.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ki19329k3ddg8si3i5lr638v9679jgx9-chromium-90.0.4430.93.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ka53csg7l4kc20ab32yn7l965si66bw9-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/4bizj1565qry8x06q88zm9fzcs1qgq4b-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ad7pw78ffx55xdfx590xiyqc86yfbc95-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/g880bzfirxnfh1d89is31mw924dvdrxi-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/lhbvavax0cbpp65mcmhzqfd2fb2mhd3j-nixos-system-desktop-20.09.20210508.1b688ca.drv' failed to build

Any advice? The target I’m building is the nixos desktop configuration here.

EDIT: I think I may have gotten this to work without CA enabled because cbindgen was cached on nixpkgs? I can’t seem to open it with nix-shell -p. However, I’m kind of at a loss on what to do now. I overrode the hash to what was expected, and I get two separate errors depending on how I override it:

error: hash mismatch in fixed-output derivation '/nix/store/c3p0s6sxkqpf66yz2nbd362mjpx3jg6w-rust-cbindgen-0.18.0-vendor.tar.gz.drv':
         specified: sha256-uaeJmGEQHVSuILlYlJOHmRWWdN6FPvrHu6CbJyb60MY=
            got:    sha256-gKf9sQuraF6zxBpyyvWseqQzrk/xD4OhsoGC0l5bm/k=
error: 1 dependencies of derivation '/nix/store/pl26dx07qrn8n2i20l65ii2x4mmhrb08-rust-cbindgen-0.18.0.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-fftw-single-3.3.8.drv-0': Directory not empty
error: 1 dependencies of derivation '/nix/store/j3vbn0jsc42haww6zwa5fkcr2r0d1nr3-spidermonkey-78.8.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/8g95aj6jq2cipyjidi0n6dji3xdh1ka1-thunderbird-78.10.1.drv' failed to build
error: 1 dependencies of derivation '/nix/store/y0ywax5r6mpbacsv5y6jl9kz1mdhcxs8-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/gf23hf8p41b3xk815jqragw4d77crfkf-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/f2w7ij4y2iyqy50aiv8x2rrwzvw23gbf-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/6b54nl9x2hjh55n8jdm1dljv6yvncasz-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/pvdrv4c6ldbjn9ip5vwm0555faff5177-nixos-system-desktop-20.09.20210508.1b688ca.drv' failed to build
-----------------------------------------------------
error: hash mismatch in fixed-output derivation '/nix/store/c3p0s6sxkqpf66yz2nbd362mjpx3jg6w-rust-cbindgen-0.18.0-vendor.tar.gz.drv':
         specified: sha256-uaeJmGEQHVSuILlYlJOHmRWWdN6FPvrHu6CbJyb60MY=
            got:    sha256-gKf9sQuraF6zxBpyyvWseqQzrk/xD4OhsoGC0l5bm/k=
error: 1 dependencies of derivation '/nix/store/pl26dx07qrn8n2i20l65ii2x4mmhrb08-rust-cbindgen-0.18.0.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-gnum4-1.4.18.drv-1/m4-1.4.18': Directory not empty
error: 1 dependencies of derivation '/nix/store/j3vbn0jsc42haww6zwa5fkcr2r0d1nr3-spidermonkey-78.8.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/8g95aj6jq2cipyjidi0n6dji3xdh1ka1-thunderbird-78.10.1.drv' failed to build
error (ignored): error: cannot unlink '/tmp/nix-build-clang-11.1.0.drv-2': Directory not empty
error: 1 dependencies of derivation '/nix/store/y0ywax5r6mpbacsv5y6jl9kz1mdhcxs8-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/gf23hf8p41b3xk815jqragw4d77crfkf-home-manager-generation.drv' failed to build
error: 1 dependencies of derivation '/nix/store/f2w7ij4y2iyqy50aiv8x2rrwzvw23gbf-user-environment.drv' failed to build
error: 1 dependencies of derivation '/nix/store/6b54nl9x2hjh55n8jdm1dljv6yvncasz-etc.drv' failed to build

I’m also not too sure what to make of the Directory not empty errors. Are those expected?

Duh that’s a shame :confused:

(It’s also a shame that the GC destroyed everything, I’d had been interested in knowing what happened exactly)

Do you by any chance still have the log handy? (nix log /nix/store/452pmql7ba96xycn5abcmg211zdlnd8z-xnu-3789.70.16.drv). I wonder whether that’s just a transient failure (OOM or something like that) or something more seriously CA related

The hash mismatch is indeed “expected“ and due to a cargo update that changed the hashes of all the cargoDeps derivations − I think there’s a nixpkgs issue about that.

Yes indeed, nix-shell is broken atm with CA derivations.

I’m not sure, I guess it must be related to the way buildRustPackage works which maybe doesn’t play well with overriding the cargoSha256, but I don’t know how it works.

Nope. Not sure they are CA related tbh, maybe some kind of race-condition between the builder still somehow running and writing to the build directory, and Nix trying to remove the same build directory (but I’m just guessing, maybe that’s something totally different). In any case that’s worth a Nix issue (with a bonus if you can reproduce it ofc :wink: )