[Nix-dev] Disaster recovery / re-deployment

Rickard Nilsson rickard.nilsson at telia.com
Tue Oct 4 11:12:50 CEST 2011


Den 2011-10-04 10:14:37 skrev Marc Weber <marco-oweber at gmx.de>:

> Excerpts from Rickard Nilsson's message of Tue Oct 04 09:53:45 +0200
> 2011:
>
> i> I took a similar route as you did, I think. I hacked nixos-install a  
> bit,
> There should be no need to hack install scripts. If they don't work for
> everybody they should be improved.
>
>> However, all that juggling with chroot, NIX_OTHER_STORES and
>> /nix/store
>> doesn't appeal to me :)
>
> That's why scripts (should) deal with it for you.
> You only checkout nixos sources. Then you run two commandlines and
> everything should be fine.

Yes, of course it should be scripted. I just did a quick hack of
nixos-install. My issue was more that the
backed up store first needed to be copied to the new root, then
it also was mounted under another directory in the new root, and
when the script runs it copies things from the mount to the store.

I'm aiming for a much simpler setup: mount your global nix store
(which is shared with other hosts) in your new empty root, then
either run a bootstrap script that generates /boot, or manually
place the boot-symlinks there. After that it should be possible to
just boot into an identical system as before.


>> I'm starting to think that maybe I should just keep a dump of the Nix
>> database, and the symlinks in /boot, around. Then it
>> should be possible to boot up the system if I just put /nix/store,
>> /boot and /etc/nixos in place, shouldn't it? When the system is booted
>> I could just restore the Nix database dump, and then the old store
>> would
>> be perfectly valid and usable, wouldn't it? Or do I also have to
>> backup
>> and restore the gcroots?
> No, they should be recreated when you run nixos-rebuild etc.
> You need two things:
>   1) put files in place (can be a backup)
>   2) install boot loader (or setup init scripts)
>
> There should be a test case for such an installation and that should
> succeed and thats it. I don't think each individual should come up with
> his/her own way of installing nixos. This will improve knowledge of
> nixos / but in the end we want computers to "just work". That's my point
> of view. Life is too short to reinvent the wheel. Because you did -
> because I did - something is wrong.
>
> You can join my git fork which still contains those changes any time.

I agree that we shouldn't reinvent stuff over and over again. To certain
degree, though, deployment probably will be customized by individuals
to fit their particular environment/needs. NixOS should provide tools
that are general enough to allow for this. nixos-install is unfortunately
not flexible enough.

That said, I'd be happy to check out your code and see if I can work
 from it instead of nixos-install. Is your code publicly available
somewhere? I already have a local git-svn clone of the Nix repositories,
with branches for my modifications, so pulling from your repository
should be simple.


   / Rickard


More information about the nix-dev mailing list