2006-11-04 13:00:05 +01:00
|
|
|
{system ? __currentSystem}:
|
|
|
|
|
2006-11-02 18:56:50 +01:00
|
|
|
rec {
|
|
|
|
|
2006-11-04 13:00:05 +01:00
|
|
|
pkgs = import ./pkgs/top-level/all-packages.nix {inherit system;};
|
2006-11-02 18:56:50 +01:00
|
|
|
|
2006-11-02 23:48:01 +01:00
|
|
|
pkgsDiet = import ./pkgs/top-level/all-packages.nix {
|
2006-11-04 13:00:05 +01:00
|
|
|
inherit system;
|
2006-11-02 23:48:01 +01:00
|
|
|
bootStdenv = pkgs.useDietLibC pkgs.stdenv;
|
|
|
|
};
|
|
|
|
|
2006-11-03 14:35:02 +01:00
|
|
|
pkgsStatic = import ./pkgs/top-level/all-packages.nix {
|
2006-11-04 13:00:05 +01:00
|
|
|
inherit system;
|
2006-11-03 14:35:02 +01:00
|
|
|
bootStdenv = pkgs.makeStaticBinaries pkgs.stdenv;
|
|
|
|
};
|
|
|
|
|
2006-11-02 18:56:50 +01:00
|
|
|
stdenvLinuxStuff = import ./pkgs/stdenv/linux {
|
|
|
|
system = pkgs.stdenv.system;
|
|
|
|
allPackages = import ./pkgs/top-level/all-packages.nix;
|
|
|
|
};
|
|
|
|
|
2006-11-02 23:48:01 +01:00
|
|
|
|
2006-11-10 15:38:15 +01:00
|
|
|
# The label used to identify the installation CD.
|
|
|
|
cdromLabel = "NIXOS";
|
|
|
|
|
|
|
|
|
2006-11-03 01:36:08 +01:00
|
|
|
# Determine the set of modules that we need to mount the root FS.
|
|
|
|
modulesClosure = import ./modules-closure.nix {
|
2006-11-03 12:47:40 +01:00
|
|
|
inherit (pkgs) stdenv kernel module_init_tools;
|
|
|
|
rootModules = ["ide-cd" "ide-disk" "ide-generic"];
|
2006-11-03 01:36:08 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-03 14:35:02 +01:00
|
|
|
# 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"
|
2006-11-06 23:21:50 +01:00
|
|
|
"source $stdenv/setup; ensureDir $out/bin; cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $out/bin; nuke-refs $out/bin/*";
|
2006-11-03 14:35:02 +01:00
|
|
|
buildInputs = [pkgs.nukeReferences];
|
|
|
|
inherit (pkgsStatic) utillinux;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-02 23:48:01 +01:00
|
|
|
# The init script of boot stage 1 (loading kernel modules for
|
|
|
|
# mounting the root FS).
|
|
|
|
bootStage1 = import ./boot-stage-1.nix {
|
2006-11-03 14:35:02 +01:00
|
|
|
inherit (pkgs) genericSubstituter;
|
2006-11-03 12:47:40 +01:00
|
|
|
inherit (pkgsDiet) module_init_tools;
|
2006-11-03 14:35:02 +01:00
|
|
|
inherit extraUtils;
|
2006-11-10 15:38:15 +01:00
|
|
|
inherit cdromLabel;
|
2006-11-03 12:47:40 +01:00
|
|
|
modules = modulesClosure;
|
2006-11-02 23:48:01 +01:00
|
|
|
shell = stdenvLinuxStuff.bootstrapTools.bash;
|
|
|
|
staticTools = stdenvLinuxStuff.staticTools;
|
|
|
|
};
|
2006-11-02 18:56:50 +01:00
|
|
|
|
2006-11-02 23:48:01 +01:00
|
|
|
|
|
|
|
# The closure of the init script of boot stage 1 is what we put in
|
|
|
|
# the initial RAM disk.
|
2006-11-02 18:56:50 +01:00
|
|
|
initialRamdisk = import ./make-initrd.nix {
|
|
|
|
inherit (pkgs) stdenv cpio;
|
2006-11-02 23:48:01 +01:00
|
|
|
packages = [];
|
|
|
|
init = bootStage1;
|
2006-11-02 18:56:50 +01:00
|
|
|
};
|
|
|
|
|
2006-11-02 23:48:01 +01:00
|
|
|
|
2006-11-08 10:31:45 +01:00
|
|
|
# The installer.
|
|
|
|
nixosInstaller = import ./installer.nix {
|
|
|
|
inherit (pkgs) stdenv genericSubstituter nix;
|
|
|
|
shell = pkgs.bash + "/bin/sh";
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-04 01:01:13 +01:00
|
|
|
# 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 {
|
2006-11-07 23:05:27 +01:00
|
|
|
inherit (pkgs) genericSubstituter coreutils findutils
|
2006-11-07 23:45:42 +01:00
|
|
|
utillinux kernel sysklogd udev module_init_tools
|
|
|
|
nettools;
|
2006-11-04 01:01:13 +01:00
|
|
|
shell = pkgs.bash + "/bin/sh";
|
2006-11-07 23:45:42 +01:00
|
|
|
dhcp = pkgs.dhcpWrapper;
|
2006-11-04 14:25:10 +01:00
|
|
|
|
|
|
|
# Additional stuff; add whatever you want here.
|
|
|
|
path = [
|
|
|
|
pkgs.bash
|
|
|
|
pkgs.bzip2
|
|
|
|
pkgs.cpio
|
|
|
|
pkgs.curl
|
|
|
|
pkgs.e2fsprogs
|
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.gnused
|
|
|
|
pkgs.gnutar
|
|
|
|
pkgs.grub
|
|
|
|
pkgs.gzip
|
|
|
|
pkgs.iputils
|
|
|
|
pkgs.less
|
|
|
|
pkgs.nano
|
|
|
|
pkgs.netcat
|
2006-11-07 23:45:42 +01:00
|
|
|
# pkgs.vim
|
2006-11-06 23:21:50 +01:00
|
|
|
pkgs.nix
|
|
|
|
pkgs.strace
|
|
|
|
pkgs.sysvinit
|
|
|
|
pkgs.procps
|
|
|
|
pkgs.shadowutils
|
|
|
|
pkgs.sysklogd
|
2006-11-08 10:31:45 +01:00
|
|
|
pkgs.rsync
|
2006-11-11 23:29:05 +01:00
|
|
|
pkgs.perl
|
2006-11-08 10:31:45 +01:00
|
|
|
nixosInstaller
|
2006-11-04 14:25:10 +01:00
|
|
|
];
|
2006-11-06 23:21:50 +01:00
|
|
|
|
|
|
|
mingetty = pkgs.mingettyWrapper;
|
2006-11-04 01:01:13 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-04 01:18:22 +01:00
|
|
|
# Since the CD is read-only, the mount points must be on disk.
|
|
|
|
cdMountPoints = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "mount-points";
|
2006-11-10 15:38:15 +01:00
|
|
|
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}
|
|
|
|
";
|
2006-11-04 01:18:22 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-02 23:48:01 +01:00
|
|
|
# Create an ISO image containing the isolinux boot loader, the
|
2006-11-06 23:21:50 +01:00
|
|
|
# kernel, the initrd produced above, and the closure of the stage 2
|
|
|
|
# init.
|
2006-11-02 18:56:50 +01:00
|
|
|
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";
|
|
|
|
}
|
2006-11-04 01:18:22 +01:00
|
|
|
{ source = cdMountPoints;
|
|
|
|
target = "/";
|
|
|
|
}
|
2006-11-02 18:56:50 +01:00
|
|
|
];
|
2006-11-04 00:41:57 +01:00
|
|
|
|
2006-11-04 01:01:13 +01:00
|
|
|
init = bootStage2;
|
2006-11-02 18:56:50 +01:00
|
|
|
|
|
|
|
bootable = true;
|
|
|
|
bootImage = "isolinux/isolinux.bin";
|
|
|
|
};
|
|
|
|
|
2006-11-06 23:21:50 +01:00
|
|
|
|
2006-11-02 18:56:50 +01:00
|
|
|
}
|