2006-11-12 18:48:47 +00:00
|
|
|
let
|
|
|
|
|
|
|
|
# The label used to identify the installation CD.
|
|
|
|
cdromLabel = "NIXOS";
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
# Build boot scripts for the CD that find the CD-ROM automatically.
|
2006-11-28 10:45:21 +00:00
|
|
|
with import ../configuration/boot-environment.nix {
|
2006-11-12 18:48:47 +00:00
|
|
|
autoDetectRootDevice = true;
|
|
|
|
rootLabel = cdromLabel;
|
2006-11-13 11:41:27 +00:00
|
|
|
stage2Init = "/init";
|
|
|
|
readOnlyRoot = true;
|
2006-11-12 18:48:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
rec {
|
|
|
|
|
2006-11-19 20:07:45 +00:00
|
|
|
inherit nixosInstaller bootStage1 upstartJobs; # !!! debug
|
2006-11-12 23:30:03 +00:00
|
|
|
|
2006-11-12 18:48:47 +00:00
|
|
|
|
|
|
|
# Since the CD is read-only, the mount points must be on disk.
|
2006-12-10 22:43:04 +00:00
|
|
|
cdMountPoints = pkgs.runCommand "mount-points" {} "
|
|
|
|
ensureDir $out
|
|
|
|
cd $out
|
|
|
|
mkdir proc sys tmp etc dev var mnt nix nix/var
|
|
|
|
touch $out/${cdromLabel}
|
|
|
|
";
|
2006-11-12 18:48:47 +00:00
|
|
|
|
|
|
|
|
2006-11-17 15:27:31 +00:00
|
|
|
# We need a copy of the Nix expressions for Nixpkgs and NixOS on the
|
|
|
|
# CD. We put them in a tarball because accessing that many small
|
|
|
|
# files from a slow device like a CD-ROM takes too long.
|
2006-12-10 22:43:04 +00:00
|
|
|
makeTarball = tarName: input: pkgs.runCommand "tarball" "
|
|
|
|
ensureDir $out
|
|
|
|
(cd ${input} && tar cvfj $out/${tarName} . \\
|
|
|
|
--exclude '*~' --exclude '.svn' \\
|
|
|
|
--exclude 'pkgs' --exclude 'result')
|
|
|
|
";
|
2006-11-17 15:27:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Put the current directory in the tarball. !!! This gives us a lot
|
|
|
|
# of crap (like .svn if this is a working copy). An "svn export"
|
|
|
|
# would be better, but that's impure.
|
|
|
|
nixosTarball = makeTarball "nixos.tar.bz2" ./.;
|
|
|
|
|
|
|
|
|
|
|
|
nixpkgsTarball = pkgs.fetchurl {
|
2006-11-23 15:25:29 +00:00
|
|
|
url = http://nix.cs.uu.nl/dist/nix/nixpkgs-0.11pre7087/nixpkgs-0.11pre7087.tar.bz2;
|
2006-11-23 21:59:25 +00:00
|
|
|
md5 = "c5840fcd049d75e00ad856ecbbef6857";
|
2006-11-17 15:27:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-12 18:48:47 +00:00
|
|
|
# Create an ISO image containing the isolinux boot loader, the
|
|
|
|
# kernel, the initrd produced above, and the closure of the stage 2
|
|
|
|
# init.
|
2006-11-28 10:45:21 +00:00
|
|
|
rescueCD = import ../helpers/make-iso9660-image.nix {
|
2006-11-17 14:13:21 +00:00
|
|
|
inherit (pkgs) stdenv cdrtools;
|
2006-11-12 18:48:47 +00:00
|
|
|
isoName = "nixos.iso";
|
|
|
|
|
|
|
|
contents = [
|
|
|
|
{ source = pkgs.syslinux + "/lib/syslinux/isolinux.bin";
|
|
|
|
target = "isolinux/isolinux.bin";
|
|
|
|
}
|
2006-11-28 10:45:21 +00:00
|
|
|
{ source = ../helpers/isolinux.cfg;
|
2006-11-12 18:48:47 +00:00
|
|
|
target = "isolinux/isolinux.cfg";
|
|
|
|
}
|
|
|
|
{ source = pkgs.kernel + "/vmlinuz";
|
|
|
|
target = "isolinux/vmlinuz";
|
|
|
|
}
|
|
|
|
{ source = initialRamdisk + "/initrd";
|
|
|
|
target = "isolinux/initrd";
|
|
|
|
}
|
|
|
|
{ source = cdMountPoints;
|
|
|
|
target = "/";
|
|
|
|
}
|
2006-11-17 15:27:31 +00:00
|
|
|
{ source = nixosTarball + "/" + nixosTarball.tarName;
|
|
|
|
target = "/" + nixosTarball.tarName;
|
|
|
|
}
|
|
|
|
{ source = nixpkgsTarball;
|
|
|
|
target = "/nixpkgs.tar.bz2";
|
|
|
|
}
|
2006-11-12 18:48:47 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
init = bootStage2;
|
|
|
|
|
|
|
|
bootable = true;
|
|
|
|
bootImage = "isolinux/isolinux.bin";
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}
|