[Nix-dev] Disaster recovery / re-deployment

Rickard Nilsson rickard.nilsson at telia.com
Fri Sep 2 11:54:17 CEST 2011


 Hi,

 I am interested in what a more or less automatic NixOS backup/restore 
 system would look like. What is the simplest way of re-building a 
 complete NixOS system given you have copies of the original 
 configuration.nix, /nix/store and the nixos and nixpkgs repositories?

 I have looked at the nixos-install-archive tools, but they seem to be 
 doing more than I want, like checking out repositories etc. Essentially 
 what I want is to be able to do the following:

 On a computer running some Linux that might be NixOS or something else:

 1. Prepare an empty file system, /path/to/newroot.

 2. Make sure /nix/store is copied or mounted to it, likewise with 
 /etc/nixos/configuration.nix, /etc/nixos/nixos and /etc/nixos/nixpkgs. 
 Mount anything else, for example /boot if that should be on a separate 
 file system.

 3. Run nixos-repair /path/to/newroot

 Now you have a system that should be identical to how it was before, 
 maybe except for the boot loader that probably must be setup manually 
 before the first boot.

 Do you have any hints on how I can write the nixos-repair utility? Or 
 does it already exist? This is also a bit related to 
 http://mail.cs.uu.nl/pipermail/nix-dev/2011-August/006667.html , since 
 such a utility also could be used to populate a RAM-disk root, if it was 
 executed during init stage 1.


 Regards,
   Rickard Nilsson



More information about the nix-dev mailing list