Hello world derivation is not deterministic

Hi,

{ pkgs ? import <nixpkgs> {} }:
let x = 1;
in pkgs.python39.withPackages (p: with p; [ toml ])

on Big Sur nix-shell --check fails:

warning: rewriting hashes in ‘/nix/store/8p8pyq6i00jsyhfqkq673v2cl24c1nqm-bash-4.4-p23-dev’; cross fingers
warning: rewriting hashes in ‘/nix/store/ca1bjfky2gv78sn8c4fd8rfikbni8001-bash-4.4-p23-doc’; cross fingers
warning: rewriting hashes in ‘/nix/store/i0cywkxgswx6s39x8c7sdi0lz42nhsgd-bash-4.4-p23-info’; cross fingers
warning: rewriting hashes in ‘/nix/store/hiw1hs9548gfnlzy8zkn1pm9ihadsni1-bash-4.4-p23-man’; cross fingers
warning: rewriting hashes in ‘/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23’; cross fingers
derivation ‘/nix/store/8qb1a1whbyr4978gpbixcq3734fxj2hh-bash-4.4-p23.drv’ may not be deterministic: output ‘/nix/store/715y5lnw12vdcc3hh9sc9vbkdi6c83x6-bash-4.4-p23’ differs
error: build of ‘/nix/store/2k8d958f82nxfrhmxgw992hhv3lsikvy-perl-5.34.0.drv’, ‘/nix/store/80cmr95cn7s12j373vwaf86an1aca0sx-bash-interactive-4.4-p23.drv’, ‘/nix/store/8qb1a1whbyr4978gpbixcq3734fxj2hh-bash-4.4-p23.drv’, ‘/nix/store/ajynccy80qndcwljpna4f7dfp26ih55x-python3.9-toml-0.10.2.drv’, ‘/nix/store/b0spz3vk1fhyd3kfm1xr8mgx08x3nmk4-hook.drv’, ‘/nix/store/mr6bp3vwsfjal2ckmap0inavqw9axznm-builder.pl.drv’, ‘/nix/store/ni5iprpnd8fp2q29iq9zhd5z2k9lv0vl-stdenv-darwin.drv’, ‘/nix/store/nrs1sqb6canfs4iz5iadi19wbfjdxgqv-python3-3.9.6.drv’ failed

Are you sure it’s right command? I never used it, but looking for the documentation to the option it’s is in man nix-store as a suboption of --realise so I think you should do:


$ nix-build
these 2 derivations will be built:
  /nix/store/71v5bm8xxaizmr6va1sfzza34i0y4yxz-builder.pl.drv
  /nix/store/x1r2014xc76vpx2ilwd3f9fdzhcflz42-python3-3.9.4-env.drv
these 15 paths will be fetched (20.94 MiB download, 113.14 MiB unpacked):
  /nix/store/1rz07gzbf4p2l1v0r6idag6gfncgblmy-diffutils-3.7
  /nix/store/6ba6w5fb5fs24x6xh3p40v3y5ih4l3ql-python3.9-toml-0.10.2
  /nix/store/841p8k91jr6ynyymjq71m8n0dfjwx25i-hook
  /nix/store/al1x84ykihyf0yd6f1hh6llrlj7as23s-findutils-4.7.0
  /nix/store/as093a69gbw9nsyd6y320hcim0z214dm-gawk-5.1.0
  /nix/store/b92bv871ikpy48w6fw01lz0x91hd2m2h-patchelf-0.12
  /nix/store/ba9vnjihlsqibrirx0jh10pjv1k6y2rn-patch-2.7.6
  /nix/store/f22f54rk9ncdyaq83bcanf1w9x02nn7y-ed-1.17
  /nix/store/fvyll1a0lxcny4jb817l9aqlsm2v371z-gnused-4.8
  /nix/store/kla99wirgvxk39168q3lgj6r8x471cb8-python3-3.9.4
  /nix/store/nw9a3z2gwk4gf8khyv941nzp2wnal4d3-hook
  /nix/store/qlr1ffwc6z9inhzn3qk58k627ps7k7pv-perl-5.32.1
  /nix/store/qwxz3m0xpqk9sjdgcpzjwbnzi911q5jp-gnumake-4.3
  /nix/store/szx7hzq7859h026qcixgmmiqahy252ml-stdenv-linux
  /nix/store/xb9rnfx0iqwdl04wd94im2ih0i2ai79y-tzdata-2021a
copying path '/nix/store/841p8k91jr6ynyymjq71m8n0dfjwx25i-hook' from 'https://cache.nixos.org'...
copying path '/nix/store/xb9rnfx0iqwdl04wd94im2ih0i2ai79y-tzdata-2021a' from 'https://cache.nixos.org'...
copying path '/nix/store/as093a69gbw9nsyd6y320hcim0z214dm-gawk-5.1.0' from 'https://cache.nixos.org'...
copying path '/nix/store/qlr1ffwc6z9inhzn3qk58k627ps7k7pv-perl-5.32.1' from 'https://cache.nixos.org'...
copying path '/nix/store/1rz07gzbf4p2l1v0r6idag6gfncgblmy-diffutils-3.7' from 'https://cache.nixos.org'...
copying path '/nix/store/f22f54rk9ncdyaq83bcanf1w9x02nn7y-ed-1.17' from 'https://cache.nixos.org'...
copying path '/nix/store/qwxz3m0xpqk9sjdgcpzjwbnzi911q5jp-gnumake-4.3' from 'https://cache.nixos.org'...
copying path '/nix/store/al1x84ykihyf0yd6f1hh6llrlj7as23s-findutils-4.7.0' from 'https://cache.nixos.org'...
copying path '/nix/store/fvyll1a0lxcny4jb817l9aqlsm2v371z-gnused-4.8' from 'https://cache.nixos.org'...
copying path '/nix/store/nw9a3z2gwk4gf8khyv941nzp2wnal4d3-hook' from 'https://cache.nixos.org'...
copying path '/nix/store/b92bv871ikpy48w6fw01lz0x91hd2m2h-patchelf-0.12' from 'https://cache.nixos.org'...
copying path '/nix/store/ba9vnjihlsqibrirx0jh10pjv1k6y2rn-patch-2.7.6' from 'https://cache.nixos.org'...
copying path '/nix/store/kla99wirgvxk39168q3lgj6r8x471cb8-python3-3.9.4' from 'https://cache.nixos.org'...
copying path '/nix/store/szx7hzq7859h026qcixgmmiqahy252ml-stdenv-linux' from 'https://cache.nixos.org'...
building '/nix/store/71v5bm8xxaizmr6va1sfzza34i0y4yxz-builder.pl.drv'...
copying path '/nix/store/6ba6w5fb5fs24x6xh3p40v3y5ih4l3ql-python3.9-toml-0.10.2' from 'https://cache.nixos.org'...
building '/nix/store/x1r2014xc76vpx2ilwd3f9fdzhcflz42-python3-3.9.4-env.drv'...
created 220 symlinks in user environment
/nix/store/pkdf7nlrhvkdfikzjy8pkwy48yp9mi60-python3-3.9.4-env

$ nix-build --check
checking outputs of '/nix/store/x1r2014xc76vpx2ilwd3f9fdzhcflz42-python3-3.9.4-env.drv'...
created 220 symlinks in user environment
/nix/store/pkdf7nlrhvkdfikzjy8pkwy48yp9mi60-python3-3.9.4-env

$ echo $?
0

I think that a nix-shell is impure most of the times…

1 Like