0b26af2188
boots into stage 1 (kernel+initrd) succesfully. `system-configuration.nix' contains the definition of the configuration to be installed. The attribute systemConfiguration is installed into the profile /nix/var/nix/profiles/system. Then the program /nix/var/nix/profiles/system/bin/switch-to-configuration is called to finalise the installation. This program (generated by system-configuration.sh) installs Grub on the drive with a menu that contains the entry for the desired kernel and initrd. In principle this allows us to do rollbacks to previous system configurations by doing `nix-env --rollback' and then calling switch-to-configuration to update Grub. Ideally this should be done in a single command (and we should consider the obvious risk of garbage collecting the current kernel etc. to which the current Grub menu points...). Maybe the responsibility for generating the Grub menu should be placed somewhere else. For instance, we could generate a Grub menu automatically out of all the generations in the `system' profile. svn path=/nixu/trunk/; revision=7009
66 lines
1.4 KiB
Nix
66 lines
1.4 KiB
Nix
let
|
|
|
|
# The label used to identify the installation CD.
|
|
cdromLabel = "NIXOS";
|
|
|
|
in
|
|
|
|
# Build boot scripts for the CD that find the CD-ROM automatically.
|
|
with import ./rescue-system.nix {
|
|
autoDetectRootDevice = true;
|
|
rootLabel = cdromLabel;
|
|
};
|
|
|
|
|
|
rec {
|
|
|
|
inherit nixosInstaller; # !!! debug
|
|
|
|
|
|
# Since the CD is read-only, the mount points must be on disk.
|
|
cdMountPoints = pkgs.stdenv.mkDerivation {
|
|
name = "mount-points";
|
|
builder = builtins.toFile "builder.sh" "
|
|
source $stdenv/setup
|
|
mkdir $out
|
|
cd $out
|
|
mkdir proc sys tmp etc dev var mnt nix nix/var
|
|
touch $out/${cdromLabel}
|
|
";
|
|
};
|
|
|
|
|
|
# Create an ISO image containing the isolinux boot loader, the
|
|
# kernel, the initrd produced above, and the closure of the stage 2
|
|
# init.
|
|
rescueCD = import ./make-iso9660-image.nix {
|
|
inherit (pkgs) stdenv cdrtools;
|
|
isoName = "nixos.iso";
|
|
|
|
contents = [
|
|
{ source = pkgs.syslinux + "/lib/syslinux/isolinux.bin";
|
|
target = "isolinux/isolinux.bin";
|
|
}
|
|
{ source = ./isolinux.cfg;
|
|
target = "isolinux/isolinux.cfg";
|
|
}
|
|
{ source = pkgs.kernel + "/vmlinuz";
|
|
target = "isolinux/vmlinuz";
|
|
}
|
|
{ source = initialRamdisk + "/initrd";
|
|
target = "isolinux/initrd";
|
|
}
|
|
{ source = cdMountPoints;
|
|
target = "/";
|
|
}
|
|
];
|
|
|
|
init = bootStage2;
|
|
|
|
bootable = true;
|
|
bootImage = "isolinux/isolinux.bin";
|
|
};
|
|
|
|
|
|
}
|