1cec62ba5d
at the end of stage 2. * Stage 2: set MODULE_DIR to point at a full module tree. svn path=/nixu/trunk/; revision=6954
133 lines
3.4 KiB
Nix
133 lines
3.4 KiB
Nix
{system ? __currentSystem}:
|
|
|
|
rec {
|
|
|
|
pkgs = import ./pkgs/top-level/all-packages.nix {inherit system;};
|
|
|
|
pkgsDiet = import ./pkgs/top-level/all-packages.nix {
|
|
inherit system;
|
|
bootStdenv = pkgs.useDietLibC pkgs.stdenv;
|
|
};
|
|
|
|
pkgsStatic = import ./pkgs/top-level/all-packages.nix {
|
|
inherit system;
|
|
bootStdenv = pkgs.makeStaticBinaries pkgs.stdenv;
|
|
};
|
|
|
|
stdenvLinuxStuff = import ./pkgs/stdenv/linux {
|
|
system = pkgs.stdenv.system;
|
|
allPackages = import ./pkgs/top-level/all-packages.nix;
|
|
};
|
|
|
|
|
|
# Determine the set of modules that we need to mount the root FS.
|
|
modulesClosure = import ./modules-closure.nix {
|
|
inherit (pkgs) stdenv kernel module_init_tools;
|
|
rootModules = ["ide-cd" "ide-disk" "ide-generic"];
|
|
};
|
|
|
|
|
|
# Some additional utilities needed in stage 1, notably mount. We
|
|
# don't want to bring in all of util-linux, so we just copy what we
|
|
# need.
|
|
extraUtils = pkgs.stdenv.mkDerivation {
|
|
name = "extra-utils";
|
|
builder = builtins.toFile "builder.sh"
|
|
"source $stdenv/setup; ensureDir $out/bin; cp $utillinux/bin/mount $out/bin; nuke-refs $out/bin/mount";
|
|
buildInputs = [pkgs.nukeReferences];
|
|
inherit (pkgsStatic) utillinux;
|
|
};
|
|
|
|
|
|
# The init script of boot stage 1 (loading kernel modules for
|
|
# mounting the root FS).
|
|
bootStage1 = import ./boot-stage-1.nix {
|
|
inherit (pkgs) genericSubstituter;
|
|
inherit (pkgsDiet) module_init_tools;
|
|
inherit extraUtils;
|
|
modules = modulesClosure;
|
|
shell = stdenvLinuxStuff.bootstrapTools.bash;
|
|
staticTools = stdenvLinuxStuff.staticTools;
|
|
};
|
|
|
|
|
|
# The closure of the init script of boot stage 1 is what we put in
|
|
# the initial RAM disk.
|
|
initialRamdisk = import ./make-initrd.nix {
|
|
inherit (pkgs) stdenv cpio;
|
|
packages = [];
|
|
init = bootStage1;
|
|
};
|
|
|
|
|
|
# The init script of boot stage 2, which is supposed to do
|
|
# everything else to bring up the system.
|
|
bootStage2 = import ./boot-stage-2.nix {
|
|
inherit (pkgs) genericSubstituter coreutils utillinux kernel;
|
|
shell = pkgs.bash + "/bin/sh";
|
|
|
|
# Additional stuff; add whatever you want here.
|
|
path = [
|
|
pkgs.bash
|
|
pkgs.bzip2
|
|
pkgs.cpio
|
|
pkgs.curl
|
|
pkgs.e2fsprogs
|
|
pkgs.findutils
|
|
pkgs.gnugrep
|
|
pkgs.gnused
|
|
pkgs.gnutar
|
|
pkgs.grub
|
|
pkgs.gzip
|
|
pkgs.iputils
|
|
pkgs.less
|
|
pkgs.module_init_tools
|
|
pkgs.nano
|
|
pkgs.netcat
|
|
pkgs.nettools
|
|
pkgs.vim
|
|
];
|
|
};
|
|
|
|
|
|
# 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";
|
|
};
|
|
|
|
|
|
# Create an ISO image containing the isolinux boot loader, the
|
|
# kernel, and initrd produced above.
|
|
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";
|
|
};
|
|
|
|
|
|
}
|