Hi all,
I create a simple setup with two machines.
A fast builder one, and a slower one.
Both machine have the same nix store, in particular: /cvmfs/packages.redeardlab.com/nix
Having a custom store path, everything is build from scratch, I am ok with that.
I build bash
on the fast machine, it took a while, it builds GCC, etc, but eventually it worked.
Now I would like to install the package bash
into the slower machine.
I exported the closure from the fast machine:
$ nix-store -qR /cvmfs/packages.redbeardlab.com/nix/store/4rsxigbrnrcjlvkrwags4w8vn4l0p957-bash-5.0-p17
/cvmfs/packages.redbeardlab.com/nix/store/ch9axn8z538896ky2dh835lm54zf9whn-libunistring-0.9.10
/cvmfs/packages.redbeardlab.com/nix/store/ifxlq9j8hmj5303252q6cgb8wb5gccz3-libidn2-2.3.0
/cvmfs/packages.redbeardlab.com/nix/store/45j96ybrkc8b4dyn73k1h2wnlbfrglir-glibc-2.31
/cvmfs/packages.redbeardlab.com/nix/store/4rsxigbrnrcjlvkrwags4w8vn4l0p957-bash-5.0-p17
$ nix-store --export $(nix-store -qR /cvmfs/packages.redbeardlab.com/nix/store/4rsxigbrnrcjlvkrwags4w8vn4l0p957-bash-5.0-p17) > bash.closure
I moved the bash.closure in the slow machine using scp.
And finally I imported the closure back.
nix-store --import < bash.closure
Everything worked correctly, and indeed in the slow machine I now see the store populated with the directory I would expect.
$ ll /cvmfs/packages.redbeardlab.com/nix/store/
total 32
drwxr-xr-x 7 redbeardlab redbeardlab 4096 Nov 30 23:42 ./
drwxr-xr-x 3 redbeardlab redbeardlab 4096 Nov 30 23:42 ../
drwxr-xr-x 2 redbeardlab redbeardlab 4096 Nov 30 23:42 .links/
dr-xr-xr-x 6 redbeardlab redbeardlab 4096 Jan 1 1970 45j96ybrkc8b4dyn73k1h2wnlbfrglir-glibc-2.31/
dr-xr-xr-x 4 redbeardlab redbeardlab 4096 Jan 1 1970 4rsxigbrnrcjlvkrwags4w8vn4l0p957-bash-5.0-p17/
dr-xr-xr-x 3 redbeardlab redbeardlab 4096 Jan 1 1970 ch9axn8z538896ky2dh835lm54zf9whn-libunistring-0.9.10/
dr-xr-xr-x 4 redbeardlab redbeardlab 4096 Jan 1 1970 ifxlq9j8hmj5303252q6cgb8wb5gccz3-libidn2-2.3.0/
However, if in the slow machine I try to install bash nix-env -i bash
, it tries to compile everything from scratch.
$ nix-env -i bash
installing 'bash-5.0-p17'
these derivations will be built:
/cvmfs/packages.redbeardlab.com/nix/store/0gyslks2avwcbrqhw3ddf6j2d0fadm48-gcc-9.3.0.tar.xz.drv
/cvmfs/packages.redbeardlab.com/nix/store/f45vl1q70h56xjpc8ii088r8fl6i2wvy-bootstrap-tools.tar.xz.drv
/cvmfs/packages.redbeardlab.com/nix/store/l4m4rrrbqmxayy9awj1m8z3mhhcxy517-busybox.drv
...
/cvmfs/packages.redbeardlab.com/nix/store/s18ms93xrbnkcl3mnwcga40g74n96qqd-bash50-012.drv
/cvmfs/packages.redbeardlab.com/nix/store/vsi0mjq1q12a9c1xkix75fvbbmxiich5-bash50-010.drv
/cvmfs/packages.redbeardlab.com/nix/store/279scdvfprpxh3yaki28cn1ir91crmp3-bash-5.0-p17.drv
Why this happens?
I was hoping that the slow machine would just create the necessary symlinks without building any software.
How can this be checked?