Problem using store from existing host for new install

For bandwidth reasons I’m trying to use an existing host with a nearly identical setup to install a new host. However even after finding a lot of existing store content the system wants to build a lot of packages from source:

boot-host> nixos-install -v --option require-sigs false --option trusted-substituters ssh-ng://me@other-host --option substituters ssh-ng://me@other-host --flake .#new-host

copying channel...
building the flake in git+file:///root/nixos?ref=refs%2fheads%2fmain&rev=abcdef...

these 476 derivations will be built:

Checking the store on the other host shows that files are there:

other-host> cd /nix/store
other-host> nix-store --query q072lsl54bjjlgsj06w7fb431cz2ckci-xgcc-12.2.0.drv

Adding multiple -v to nixos-install didn’t reveal the reason why the packages are rebuild.

Is there some way to make nixos-install take the existing packages and just put them in the new system?

Thank you!

are you sure you’re actually using the same revision of nixpkgs? If the nixpkgs versions are too different, the packages will be diverged, even if the version numbers are the same.

It’s also weird that it’s building them from source and not getting them from, unless you’re explicitly disabling that.

I get confused with these options and feel like I never even have them quite right on my system (and use a nix wrapper script that explicitly sets them) but OP probably wants extra-trusted-subtituters and extra-substituters to augment

oh, yea I hadn’t even seen that they probably accidentally disabled the cache by using --trusted-substituters

Thanks for your responses. As written in my post I didn’t want to have to join in because I thought, but maybe that wasn’t the case, that “cloning” an a system with the same git-stored config would not require much stuff from the Internet.

What worked at the end was copying over all files from /nix/store with rsync -avzpHt --ignore-existing. After that the compilation process was skipped, the installer finished and the system was useable. But I guess that left me with an nondeterministic /nix/store.

In future you could try out nixos-anywhere.