I ran into an issue on my laptop which is running NixOS. I had the laptop setup to use my desktop at home as a binary cache server. This allows me to download or compile binary packages once on my desktop, then pull them to my laptop. The server is only accessible inside my LAN.

To setup the binary caching system I added this to /etc/nixos/configuration.nix on my laptop

{
  nix.binaryCaches = [
      "http://chasedesktop.lan:6969/"
      "https://cache.nixos.org/"
    ];
}

And on my desktop I added this to my /etc/nixos/configuration.nix

{
    nix-serve = {
      enable = true;
      port = 6969;
      secretKeyFile="/root/nix-serve.chasedesktop.lan.sec";
    };
}

I'll note that the desktop's hostname is 'chasedesktop', my local domain is 'lan', the port '6969' is arbitrary, and the file '/root/nix-serve.chasedesktop.lan.sec' was generated using the command nix-store --generate-binary-cache-key chasedesktop.lan /root/nix-serve.chasedesktop.lan.sec /root/nix-serve.chasedesktop.lan.sec.pub the file's location is also arbitrary.

When I tried to use Nix on the laptop while it was not on the network I was incapable of installing any packages or even changing system configuration because nix would try to connect to the unavailable desktop server. I found a solution, which is good enough for me. There is a nix option called 'substituters' which can be passed to nix-env or nixos-rebuild.

When installing a package I ran a command line like this nix-env -iA nixos.speedcrunch --option substitute true --option substituters 'https://cache.nixos.org'