Hi! Recently I tried to use nix-freeze-tree to deploy Python code and discovered that nix-freeze-tree does not play well with propagatedBuildInputs. Here is minimal reproducer:
with (import <nixpkgs> { });
let
freeze = (import ~/devel/upstream/nix-freeze-tree { }).freeze;
part2 = freeze (stdenv.mkDerivation {
name = "part2";
propagatedBuildInputs = [ hello ];
src = ./.;
installPhase = ''
mkdir -p $out/bin
touch $out/bin/part2.{foo,bar,baz}
'';
});
in freeze (stdenv.mkDerivation {
name = "part3";
propagatedBuildInputs = [ part2 ];
src = ./.;
installPhase = ''
mkdir -p $out/bin
touch $out/bin/part3.{foo,bar,baz}
'';
})
Attempt to build this derivation results in following error:
building '/nix/store/qx041vnifnmrg8qi6nhfv6j0g1bmdyjx-part2.drv'...
unpacking sources
unpacking source archive /nix/store/m9sg1hs6m6q57gjhjiqsvdp997vb2fcz-freeze
source root is freeze
patching sources
configuring
no configure script, doing nothing
building
no Makefile, doing nothing
installing
post-installation fixup
shrinking RPATHs of ELF executables and libraries in /nix/store/q93c17rfw1cwk20hxfa4wrms3mx4d4ci-part2
strip is /nix/store/nfs9wf6ipffr9g9ylzb4i9c1i607nxvq-binutils-2.31.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/q93c17rfw1cwk20hxfa4wrms3mx4d4ci-part2/bin
patching script interpreter paths in /nix/store/q93c17rfw1cwk20hxfa4wrms3mx4d4ci-part2
checking for references to /build/ in /nix/store/q93c17rfw1cwk20hxfa4wrms3mx4d4ci-part2...
building '/nix/store/as3kyliiivah7klbbs23ljcx78dmz9fn-part2-frozen.drv'...
installing
writing /nix/store/jfjhdbm8sljz2l3ci4vfj46vvib9hfjp-part2-frozen/default.nix
writing /nix/store/jfjhdbm8sljz2l3ci4vfj46vvib9hfjp-part2-frozen/bin/default.nix
writing /nix/store/jfjhdbm8sljz2l3ci4vfj46vvib9hfjp-part2-frozen/nix-support/default.nix
building '/nix/store/qkwarq6cmaplc3brxasbkqlnyqlz4snx-q93c17rfw1cwk20hxfa4wrms3mx4d4ci-part2.drv'...
installing
'bin' -> '/nix/store/i4an0sjn86dx3w714dxrj6aiznd9v57b-bin'
'nix-support' -> '/nix/store/az6hmiaq9j5996skfix0wcy7p8nxp5gm-nix-support'
building '/nix/store/q9dwjh9ydfyxk19524xwvjafl25wx481-part3.drv'...
build input /nix/store/njlavpa90laywf22b1myif5101qhln8r-hello-2.10 does not exist
builder for '/nix/store/q9dwjh9ydfyxk19524xwvjafl25wx481-part3.drv' failed with exit code 1
cannot build derivation '/nix/store/lydgqdw4gdigv46216c9yg18jid002rn-part3-frozen.drv': 1 dependencies couldn't be built
error: build of '/nix/store/lydgqdw4gdigv46216c9yg18jid002rn-part3-frozen.drv' failed
Is it bug, or I use the tool wrong?
PS. It is first time I use todo.sr.ht, sorry if I messed formatting.
Possibly both?
Is it a bug? Maybe. I am unable to make
propagatedBuildInputs
work, even if I modify thefreeze
function indefault.nix
to setpropagatedBuildInputs = drv.propagatedBuildInputs
.Are you using it wrong? Maybe. I only see value in freezing nearly-final derivations before deployment, not all the intermediate steps.
So I'm not really sure if/how I can fix this.