NixOps deploy to targets without internet connection

#1

Hello,

I’m using nixops to deploy various ”little” machines at home. Some of them should not have an internet connection. Is it possible (maybe with some flags I couldn’t find) to deploy to those “offline” machines? The “build machine” has internet and could download all the nar files and then push them to the machines. AFAICT all machines download the nar files again and again, is this true?

When I try to deploy to those machines, I see these messages:

warning: unable to download 'https://cache.nixos.org/94shd2jl71af2yz95da52w98m2wl1r8g.narinfo': Couldn't connect to server (7); retrying in 320 ms

Thank you and kind regards
Eike

#2

you can change the NIX_PATH var on the deployment specification to point to a local copy of nixpkgs.
nix.nixPath = [ “…” ]; is one way (edit: nixPath is a list of strings not just a string)

1 Like
#3

I think you can set deployment.hasFastConnection = true; in order to disable substitution during nix-copy-closure.

1 Like
#4

Take a look at the nixos-rebuild man page.
The flags --build-host and --target-host should be what you are looking for.
Also you can specify the nixos-config and nixpkgs channel through the -I flag. (take a look at the NIX_PATH environment variable)

#5

If you want to use NixOps for machines that don’t have internet, hasFastConnection is the most direct answer to the question.

#6

Hello,

thank you all for your helpful replies! I’ll try it out this evening.

regards,
Eike

#7

Hi there again,

I just tried the hasFastConnection = true option and it it works perfectly!

Thank you very much!
Regards
Eike