[Nix-dev] rewrite of nixos-install

Marc Weber marco-oweber at gmx.de
Tue Dec 15 07:56:01 CET 2009


installer2
===========

If you like it we can deprecate nixos-install soon.
Right now both can be used.

I rewrote it because adding the bootstrap archive to nixos-install made
everything worse.

Now I tried using one script for a particular task:

nixos-prepare-install:
  checks that mountPoint is a mount point (unless you pass --dir-ok)
  runs nixos-hardware-scan to create initial configuration.nix
  copies nixos/nixpkgs sources to /etc/nixos
  If you like you can use checkout-sources to get a fresh svn checkout!
  creates /bin/sh symlink
  copies nix and validates initial store paths.

  Note: The targets /etc/nixos/{nixos,nixpkgs,configuration.nix}
  are only created if they don't exist unless you use --force.
  If you use --force the nixos-install behaviour is used:
  Existing targets are moved to $target-$timestamp so nothing can be lost.

run-in-chroot:
  very useful utility script. It mounts /dev /proc /sys etc.
  Then it runs a given command.
  Thus if you want to fix a broken system you can use
  
    run-in-chroot /bin/sh

  to setup your chroot.

nixos-bootstrap:
  called this way:

    run-in-chroot "nix/store/nixos-bootstrap --install"

  This does everything else: It runs nix-env to realise the system finally
  installing grub


I'd like to tell you about one implemenation detail:
umountUnder(){ .. } was used to umount submounts recursively.

I think it is no longer required because umount -l does this job.



NEW: HOWTO install NixOS from a bootstrap archive
=================================================

export mountPoint=$target # defaults to /mnt
tar xfj $ARCHIV -C $mountPoint 

bash $mountPoint/nix/store/nixos-prepare-install # see --help

$EDITOR $mountPoint/etc/nixos/configuration.nix

# you can replace --install by --help to get more info
bash $mountPoint/nix/store/run-in-chroot "/nix/store/nixos-bootstrap --install"


This archive is create by
nix-build $NIXOS -A config.system.build.minimalInstaller


As always I appreciate feedback and I'll try to fix my bugs ASAP :)

Marc Weber



More information about the nix-dev mailing list