[Nix-dev] Disaster recovery / re-deployment

Rickard Nilsson rickard.nilsson at telia.com
Tue Oct 4 11:45:14 CEST 2011


Den 2011-10-04 11:21:06 skrev Marc Weber <marco-oweber at gmx.de>:

>> 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.
> It looks you don't know the internals of nixos well yet.
> /boot is generated by any of the nixos-install activation or boot
> phases. So if you "script that" you duplicate work - why?
> Because each time you update nixos using nixos-rebuild new kernels have
> to be copied to /boot depending on your configuration options - and that  
> has
> already been implemented.

I admit I do not know the internals of nixos well yet. But I am aware
that /boot is generated by nixos-rebuild. I do have my own boot
loader generator already in place that generates boot menus, kernels
and initrds that is suitable for my particular PXE-booting (ipxe, really).

A script that would setup /boot, would of course make use of nixos-rebuild
or nixos-install, not re-implement them.

However, as I've mentioned previously, nixos-install simply does too
much to be suitable for me. nixos-rebuild would be better suited,
but the problem is that if you chroot into a "restored" system where
you just have mounted /nix/store and /etc/nixos and then try to run
nixos-rebuild, Nix will start destroying the existing store and
rebuild _everything_. So, what I want to come up with is a script
that would set up the restored store and nix in a way that would make
it possible to run nixos-rebuild (or something similar) but still use
the store in place. I don't want a NIX_OTHER_STORES, and I don't want
to copy a minimal install store. Everything that is needed should
really already exist in the mounted /nix/store.


>> 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
> Yes - I push to gitorious. However I'd prefer you sending me your ssh
> pub key so that you can clone from my SSH account.
> http://mawercer.de/~nix/
>
> However in your case  
> http://mawercer.de/~marc/minimal-install-archive.patch should be enough
> if you're lucky.

Thanks! I will start out from that and see where I end up.


   / Rickard


More information about the nix-dev mailing list