Doomsday preparation for users of NIXOS?

Without internet, how could I install nixos on a PC?

If the doomsday comes unpredicted:
Given that I have already had an nixos PC running, which can be used as a binary cache, how to solve the problem of channel files?

If we know tomorrow is the doomsday?
What can we do ?

I assume the doomsday is just a connectivity doomsday; this forum might not be the best place for «drinking-water-scarce» doomsday advice, and in the milder «electricity-scarce» scenario I am not sure NixOS is the best choice.

Aren’t channel files in store, with something in /nix/var/nix/profiles a symlink to them? You should be able to copy and add them via a file:/// URL, or via a small web server. You might want to have a small webserver handy anyway to share files via adhoc WiFi with random devices.

I don’t remember precise details as I prefer just using Git clones and manual management of $NIX_PATH. Those can be just cloned.

If you have all the necessary stuff, you usually can nixos-install to a USB drive, then boot from it and nixos-install to target. This probably involves some messing with what you trust as binary caches.

You might want to find all fixed-output transitive dependencies of your system and pre-realise them. You might want to evaluate all dependencies of the minimal installation ISO expression and pre-realise them. You might want to make sure you have nix-serve installed. And dependencies of building Nixpkgs/NixOS/Nix manuals (including both source repositories). And a small webserver. And something sufficient for running a local TLS CA just in case. Having sshd goes without saying, I hope.

I guess for intermediate scenarios you want to save the addresses of Chinese binary cache mirrors.

Also, there some tricky things in the process, so if you expect connectivity-out maybe practice while you still can search the documentation online? And save locally all the documentation, forum posts, etc. that you found useful.

2 Likes

Maybe this discussion is also relevant:

2 Likes

Here is how to do offline source builds: Offline build "source closure" - #8 by tfc

1 Like