2006-12-11 17:36:57 +00:00
|
|
|
{ platform ? __currentSystem
|
|
|
|
, stage2Init ? ""
|
2006-12-11 16:10:23 +00:00
|
|
|
, configuration
|
2006-11-12 18:48:47 +00:00
|
|
|
}:
|
2006-11-04 12:00:05 +00:00
|
|
|
|
2006-11-02 17:56:50 +00:00
|
|
|
rec {
|
|
|
|
|
2006-12-11 15:47:30 +00:00
|
|
|
# Make a configuration object from which we can retrieve option
|
|
|
|
# values.
|
2007-11-09 18:49:45 +00:00
|
|
|
config = pkgs.lib.addDefaultOptionValues optionDeclarations configuration;
|
|
|
|
|
|
|
|
optionDeclarations = import ./options.nix {inherit pkgs; inherit (pkgs.lib) mkOption;};
|
|
|
|
|
2006-12-11 15:47:30 +00:00
|
|
|
|
2006-12-11 17:36:57 +00:00
|
|
|
pkgs = import ../pkgs/top-level/all-packages.nix {system = platform;};
|
2006-11-02 17:56:50 +00:00
|
|
|
|
2006-11-28 10:45:21 +00:00
|
|
|
pkgsDiet = import ../pkgs/top-level/all-packages.nix {
|
2006-12-11 17:36:57 +00:00
|
|
|
system = platform;
|
2006-11-02 22:48:01 +00:00
|
|
|
bootStdenv = pkgs.useDietLibC pkgs.stdenv;
|
|
|
|
};
|
|
|
|
|
2006-11-28 10:45:21 +00:00
|
|
|
pkgsStatic = import ../pkgs/top-level/all-packages.nix {
|
2006-12-11 17:36:57 +00:00
|
|
|
system = platform;
|
2006-11-03 13:35:02 +00:00
|
|
|
bootStdenv = pkgs.makeStaticBinaries pkgs.stdenv;
|
|
|
|
};
|
|
|
|
|
2006-11-28 10:45:21 +00:00
|
|
|
stdenvLinuxStuff = import ../pkgs/stdenv/linux {
|
2006-11-02 17:56:50 +00:00
|
|
|
system = pkgs.stdenv.system;
|
2006-11-28 10:45:21 +00:00
|
|
|
allPackages = import ../pkgs/top-level/all-packages.nix;
|
2006-11-02 17:56:50 +00:00
|
|
|
};
|
|
|
|
|
2007-11-09 18:49:45 +00:00
|
|
|
manifests = config.installer.manifests; # exported here because nixos-rebuild uses it
|
2007-08-15 12:01:20 +00:00
|
|
|
|
2007-11-13 15:51:24 +00:00
|
|
|
nix = config.environment.nix pkgs;
|
2006-11-17 16:38:24 +00:00
|
|
|
|
2007-11-09 18:12:23 +00:00
|
|
|
kernel = config.boot.kernel pkgs;
|
2006-11-02 22:48:01 +00:00
|
|
|
|
2006-12-19 22:12:44 +00:00
|
|
|
rootModules =
|
2007-11-09 18:12:23 +00:00
|
|
|
config.boot.initrd.extraKernelModules ++
|
|
|
|
config.boot.initrd.kernelModules;
|
2006-12-19 22:12:44 +00:00
|
|
|
|
|
|
|
|
2006-11-03 00:36:08 +00:00
|
|
|
# Determine the set of modules that we need to mount the root FS.
|
2006-11-28 10:45:21 +00:00
|
|
|
modulesClosure = import ../helpers/modules-closure.nix {
|
2007-06-23 15:48:09 +00:00
|
|
|
inherit (pkgs) stdenv module_init_tools;
|
2007-09-18 15:06:24 +00:00
|
|
|
inherit kernel rootModules;
|
2006-11-03 00:36:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-03 13:35:02 +00: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.
|
2006-12-10 22:43:04 +00:00
|
|
|
extraUtils = pkgs.runCommand "extra-utils"
|
|
|
|
{ buildInputs = [pkgs.nukeReferences];
|
|
|
|
inherit (pkgsStatic) utillinux;
|
2007-01-10 12:42:28 +00:00
|
|
|
inherit (pkgsDiet) udev;
|
2006-12-10 22:43:04 +00:00
|
|
|
e2fsprogs = pkgs.e2fsprogsDiet;
|
2007-11-09 18:49:45 +00:00
|
|
|
devicemapper = if config.boot.initrd.lvm then pkgs.devicemapperStatic else null;
|
|
|
|
lvm2 = if config.boot.initrd.lvm then pkgs.lvm2Static else null;
|
2007-01-10 12:42:28 +00:00
|
|
|
allowedReferences = []; # prevent accidents like glibc being included in the initrd
|
2006-12-10 22:43:04 +00:00
|
|
|
}
|
|
|
|
"
|
2006-11-24 12:13:11 +00:00
|
|
|
ensureDir $out/bin
|
2007-07-05 14:19:48 +00:00
|
|
|
if test -n \"$devicemapper\"; then
|
2007-06-28 09:57:36 +00:00
|
|
|
cp $devicemapper/sbin/dmsetup.static $out/bin/dmsetup
|
|
|
|
cp $lvm2/sbin/lvm.static $out/bin/lvm
|
|
|
|
fi
|
2006-11-24 12:13:11 +00:00
|
|
|
cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $out/bin
|
|
|
|
cp -p $e2fsprogs/sbin/fsck* $e2fsprogs/sbin/e2fsck $out/bin
|
2007-01-10 12:42:28 +00:00
|
|
|
cp $udev/sbin/udevd $udev/sbin/udevtrigger $udev/sbin/udevsettle $out/bin
|
2006-11-24 12:13:11 +00:00
|
|
|
nuke-refs $out/bin/*
|
|
|
|
";
|
2006-11-03 13:35:02 +00:00
|
|
|
|
|
|
|
|
2006-11-02 22:48:01 +00:00
|
|
|
# The init script of boot stage 1 (loading kernel modules for
|
|
|
|
# mounting the root FS).
|
2006-11-28 10:45:21 +00:00
|
|
|
bootStage1 = import ../boot/boot-stage-1.nix {
|
2006-12-10 22:29:44 +00:00
|
|
|
inherit (pkgs) substituteAll;
|
2006-11-03 11:47:40 +00:00
|
|
|
inherit (pkgsDiet) module_init_tools;
|
2006-11-03 13:35:02 +00:00
|
|
|
inherit extraUtils;
|
2007-11-09 18:49:45 +00:00
|
|
|
autoDetectRootDevice = config.boot.autoDetectRootDevice;
|
2007-02-06 16:53:36 +00:00
|
|
|
fileSystems =
|
|
|
|
pkgs.lib.filter
|
|
|
|
(fs: fs.mountPoint == "/" || (fs ? neededForBoot && fs.neededForBoot))
|
2007-11-09 18:49:45 +00:00
|
|
|
(config.fileSystems);
|
|
|
|
rootLabel = config.boot.rootLabel;
|
2006-11-13 11:41:27 +00:00
|
|
|
inherit stage2Init;
|
2006-12-19 22:12:44 +00:00
|
|
|
modulesDir = modulesClosure;
|
|
|
|
modules = rootModules;
|
2006-12-10 22:29:44 +00:00
|
|
|
staticShell = stdenvLinuxStuff.bootstrapTools.bash;
|
2006-11-02 22:48:01 +00:00
|
|
|
staticTools = stdenvLinuxStuff.staticTools;
|
|
|
|
};
|
2006-11-02 17:56:50 +00:00
|
|
|
|
2006-11-02 22:48:01 +00:00
|
|
|
|
|
|
|
# The closure of the init script of boot stage 1 is what we put in
|
|
|
|
# the initial RAM disk.
|
2006-11-28 10:45:21 +00:00
|
|
|
initialRamdisk = import ../boot/make-initrd.nix {
|
2007-01-23 14:37:42 +00:00
|
|
|
inherit (pkgs) perl stdenv cpio;
|
2006-11-27 01:35:34 +00:00
|
|
|
contents = [
|
|
|
|
{ object = bootStage1;
|
|
|
|
symlink = "/init";
|
|
|
|
}
|
2007-11-09 18:49:45 +00:00
|
|
|
] ++ (if config.boot.initrd.enableSplashScreen then [
|
2007-01-23 13:44:41 +00:00
|
|
|
{ object = pkgs.runCommand "splashutils" {} "
|
|
|
|
ensureDir $out/bin
|
|
|
|
cp ${pkgs.splashutils}/bin/splash_helper $out/bin
|
|
|
|
";
|
2006-11-27 01:35:34 +00:00
|
|
|
suffix = "/bin/splash_helper";
|
|
|
|
symlink = "/sbin/splash_helper";
|
|
|
|
}
|
2006-11-28 10:45:21 +00:00
|
|
|
{ object = import ../helpers/unpack-theme.nix {
|
2006-11-27 01:35:34 +00:00
|
|
|
inherit (pkgs) stdenv;
|
2007-11-09 18:49:45 +00:00
|
|
|
theme = config.services.ttyBackgrounds.defaultTheme;
|
2006-11-27 01:35:34 +00:00
|
|
|
};
|
|
|
|
symlink = "/etc/splash";
|
|
|
|
}
|
2007-01-22 18:58:04 +00:00
|
|
|
] else []);
|
2006-11-02 17:56:50 +00:00
|
|
|
};
|
|
|
|
|
2006-11-02 22:48:01 +00:00
|
|
|
|
2006-11-08 09:31:45 +00:00
|
|
|
# The installer.
|
2007-02-06 10:46:36 +00:00
|
|
|
nixosInstall = import ../installer/nixos-install.nix {
|
2007-02-06 13:09:25 +00:00
|
|
|
inherit (pkgs) perl runCommand substituteAll;
|
2006-11-17 16:38:24 +00:00
|
|
|
inherit nix;
|
2007-11-09 18:49:45 +00:00
|
|
|
nixpkgsURL = config.installer.nixpkgsURL;
|
2006-11-08 09:31:45 +00:00
|
|
|
};
|
|
|
|
|
2007-02-06 13:09:25 +00:00
|
|
|
nixosRebuild = import ../installer/nixos-rebuild.nix {
|
|
|
|
inherit (pkgs) substituteAll;
|
2007-02-06 14:13:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nixosCheckout = import ../installer/nixos-checkout.nix {
|
|
|
|
inherit (pkgs) substituteAll;
|
2007-02-06 13:09:25 +00:00
|
|
|
};
|
|
|
|
|
2006-11-08 09:31:45 +00:00
|
|
|
|
2007-01-15 17:19:41 +00:00
|
|
|
# NSS modules. Hacky!
|
2007-01-16 16:09:43 +00:00
|
|
|
nssModules =
|
2007-11-09 18:49:45 +00:00
|
|
|
if config.users.ldap.enable then [pkgs.nss_ldap] else [];
|
2007-01-15 17:19:41 +00:00
|
|
|
|
|
|
|
nssModulesPath = pkgs.lib.concatStrings (pkgs.lib.intersperse ":"
|
|
|
|
(map (mod: mod + "/lib") nssModules));
|
|
|
|
|
|
|
|
|
2008-01-12 23:37:17 +00:00
|
|
|
# Tree of kernel modules. This includes the kernel, plus modules
|
|
|
|
# built outside of the kernel. We have to combine these into a
|
|
|
|
# single tree of symlinks because modprobe only supports one
|
|
|
|
# directory.
|
|
|
|
modulesTree = pkgs.module_aggregation (
|
|
|
|
[kernel pkgs.iwlwifi]
|
|
|
|
# !!! this should be declared by the xserver Upstart job.
|
|
|
|
++ pkgs.lib.optional (config.services.xserver.enable && config.services.xserver.videoDriver == "nvidia") pkgs.nvidiaDrivers
|
|
|
|
);
|
|
|
|
|
|
|
|
|
2007-03-04 01:16:24 +00:00
|
|
|
# Wrapper around modprobe to set the path to the modules.
|
|
|
|
modprobe = pkgs.substituteAll {
|
|
|
|
dir = "sbin";
|
|
|
|
src = ./modprobe;
|
|
|
|
isExecutable = true;
|
2007-06-23 15:48:09 +00:00
|
|
|
inherit (pkgs) module_init_tools;
|
2008-01-12 23:37:17 +00:00
|
|
|
inherit modulesTree;
|
2007-03-04 01:16:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-11-15 17:16:16 +00:00
|
|
|
# Environment variables for running Nix.
|
|
|
|
nixEnvVars =
|
|
|
|
"export NIX_CONF_DIR=/nix/etc/nix\n" +
|
|
|
|
(if config.nix.distributedBuilds then
|
|
|
|
"export NIX_BUILD_HOOK=${nix}/libexec/nix/build-remote.pl\n" +
|
|
|
|
"export NIX_REMOTE_SYSTEMS=/etc/nix.machines\n" +
|
|
|
|
"export NIX_CURRENT_LOAD=/var/run/nix/current-load\n"
|
|
|
|
else "");
|
|
|
|
|
|
|
|
|
2006-11-19 20:07:45 +00:00
|
|
|
# The services (Upstart) configuration for the system.
|
2007-03-30 12:59:43 +00:00
|
|
|
upstartJobs = import ../upstart-jobs/default.nix {
|
2007-11-15 17:16:16 +00:00
|
|
|
inherit config pkgs nix modprobe nssModulesPath nixEnvVars;
|
2006-11-19 21:03:22 +00:00
|
|
|
};
|
|
|
|
|
2006-12-09 02:51:42 +00:00
|
|
|
|
2006-12-11 15:32:10 +00:00
|
|
|
# The static parts of /etc.
|
2007-03-30 12:59:43 +00:00
|
|
|
etc = import ../etc/default.nix {
|
2007-11-15 17:16:16 +00:00
|
|
|
inherit config pkgs upstartJobs systemPath wrapperDir
|
2008-01-12 23:37:17 +00:00
|
|
|
defaultShell nixEnvVars modulesTree;
|
2007-03-30 12:55:09 +00:00
|
|
|
extraEtc = pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs);
|
2006-12-09 02:51:42 +00:00
|
|
|
};
|
|
|
|
|
2007-10-05 07:25:13 +00:00
|
|
|
# Font aggregation
|
2007-11-15 17:16:16 +00:00
|
|
|
fontDir = import ./fontdir.nix {
|
2007-12-20 04:36:30 +00:00
|
|
|
stdenv = pkgs.stdenvUsingSetupNew2;
|
2007-11-15 17:16:16 +00:00
|
|
|
inherit pkgs config;
|
|
|
|
inherit (pkgs.xorg) mkfontdir mkfontscale fontalias;
|
|
|
|
};
|
2006-12-11 15:47:30 +00:00
|
|
|
|
|
|
|
# The wrapper setuid programs (since we can't have setuid programs
|
2007-01-15 14:43:56 +00:00
|
|
|
# in the Nix store).
|
|
|
|
wrapperDir = "/var/setuid-wrappers";
|
|
|
|
|
2006-11-28 17:34:27 +00:00
|
|
|
setuidWrapper = import ../helpers/setuid {
|
|
|
|
inherit (pkgs) stdenv;
|
2007-01-15 14:43:56 +00:00
|
|
|
inherit wrapperDir;
|
2006-11-28 17:34:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-12-09 19:25:23 +00:00
|
|
|
# The packages you want in the boot environment.
|
2007-01-15 14:43:56 +00:00
|
|
|
systemPathList = [
|
2007-03-04 01:16:24 +00:00
|
|
|
modprobe # must take precedence over module_init_tools
|
2007-03-20 10:40:45 +00:00
|
|
|
pkgs.bashInteractive # bash with ncurses support
|
2006-12-09 19:25:23 +00:00
|
|
|
pkgs.bzip2
|
|
|
|
pkgs.coreutils
|
|
|
|
pkgs.cpio
|
2007-01-10 17:09:00 +00:00
|
|
|
pkgs.cron
|
2006-12-09 19:25:23 +00:00
|
|
|
pkgs.curl
|
|
|
|
pkgs.e2fsprogs
|
|
|
|
pkgs.findutils
|
2006-12-23 22:43:39 +00:00
|
|
|
pkgs.glibc # for ldd, getent
|
2006-12-09 19:25:23 +00:00
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.gnused
|
|
|
|
pkgs.gnutar
|
|
|
|
pkgs.grub
|
|
|
|
pkgs.gzip
|
|
|
|
pkgs.iputils
|
|
|
|
pkgs.less
|
2006-12-24 01:07:28 +00:00
|
|
|
pkgs.lvm2
|
2007-01-09 17:27:26 +00:00
|
|
|
pkgs.man
|
2007-01-11 00:06:46 +00:00
|
|
|
pkgs.mdadm
|
2006-12-09 19:25:23 +00:00
|
|
|
pkgs.module_init_tools
|
|
|
|
pkgs.nano
|
|
|
|
pkgs.netcat
|
|
|
|
pkgs.nettools
|
2006-12-23 22:43:39 +00:00
|
|
|
pkgs.ntp
|
2007-02-19 22:33:44 +00:00
|
|
|
pkgs.openssh
|
|
|
|
pkgs.pciutils
|
2006-12-09 19:25:23 +00:00
|
|
|
pkgs.perl
|
|
|
|
pkgs.procps
|
2006-12-11 01:03:26 +00:00
|
|
|
pkgs.pwdutils
|
2007-11-07 22:00:05 +00:00
|
|
|
pkgs.reiserfsprogs
|
2006-12-09 19:25:23 +00:00
|
|
|
pkgs.rsync
|
|
|
|
pkgs.strace
|
2007-01-11 15:32:48 +00:00
|
|
|
pkgs.su
|
2006-12-09 19:25:23 +00:00
|
|
|
pkgs.sysklogd
|
2007-05-23 14:29:34 +00:00
|
|
|
pkgs.sysvtools
|
2007-04-20 08:51:41 +00:00
|
|
|
pkgs.time
|
2006-12-09 19:25:23 +00:00
|
|
|
pkgs.udev
|
|
|
|
pkgs.upstart
|
|
|
|
pkgs.utillinux
|
2007-03-28 21:15:23 +00:00
|
|
|
pkgs.wirelesstools
|
2006-12-09 19:25:23 +00:00
|
|
|
nix
|
2007-02-06 10:46:36 +00:00
|
|
|
nixosInstall
|
2007-02-06 13:09:25 +00:00
|
|
|
nixosRebuild
|
2007-02-06 14:13:12 +00:00
|
|
|
nixosCheckout
|
2006-12-09 19:25:23 +00:00
|
|
|
setuidWrapper
|
2007-03-01 00:36:00 +00:00
|
|
|
]
|
2007-11-09 18:49:45 +00:00
|
|
|
++ pkgs.lib.optional (config.security.sudo.enable) pkgs.sudo
|
|
|
|
++ pkgs.lib.optional (config.networking.defaultMailServer.directDelivery) pkgs.ssmtp
|
2007-04-07 21:44:26 +00:00
|
|
|
++ pkgs.lib.concatLists (map (job: job.extraPath) upstartJobs.jobs)
|
2007-11-09 18:49:45 +00:00
|
|
|
++ (config.environment.extraPackages) pkgs
|
2008-01-12 22:53:13 +00:00
|
|
|
++ pkgs.lib.optional (config.fonts.enableFontDir) fontDir;
|
2006-12-09 19:25:23 +00:00
|
|
|
|
|
|
|
|
2007-01-15 14:43:56 +00:00
|
|
|
# We don't want to put all of `startPath' and `path' in $PATH, since
|
|
|
|
# then we get an embarrassingly long $PATH. So use the user
|
|
|
|
# environment builder to make a directory with symlinks to those
|
|
|
|
# packages.
|
|
|
|
systemPath = pkgs.buildEnv {
|
|
|
|
name = "system-path";
|
|
|
|
paths = systemPathList;
|
2007-12-01 20:44:27 +00:00
|
|
|
inherit (config.environment) pathsToLink;
|
2007-01-15 14:43:56 +00:00
|
|
|
ignoreCollisions = true;
|
|
|
|
};
|
|
|
|
|
2007-03-20 13:30:14 +00:00
|
|
|
|
2007-11-16 13:26:34 +00:00
|
|
|
usersGroups = import ./users-groups.nix { inherit pkgs config upstartJobs defaultShell; };
|
2007-06-08 15:41:12 +00:00
|
|
|
|
|
|
|
|
2007-03-20 13:30:14 +00:00
|
|
|
defaultShell = "/var/run/current-system/sw/bin/bash";
|
|
|
|
|
2007-01-15 14:43:56 +00:00
|
|
|
|
2006-12-09 19:25:23 +00:00
|
|
|
# The script that activates the configuration, i.e., it sets up
|
|
|
|
# /etc, accounts, etc. It doesn't do anything that can only be done
|
|
|
|
# at boot time (such as start `init').
|
2006-12-10 22:29:44 +00:00
|
|
|
activateConfiguration = pkgs.substituteAll {
|
2006-12-09 19:25:23 +00:00
|
|
|
src = ./activate-configuration.sh;
|
|
|
|
isExecutable = true;
|
|
|
|
|
2007-09-18 15:06:24 +00:00
|
|
|
inherit etc wrapperDir systemPath modprobe defaultShell kernel;
|
2007-11-09 18:49:45 +00:00
|
|
|
readOnlyRoot = config.boot.readOnlyRoot;
|
|
|
|
hostName = config.networking.hostName;
|
2007-04-07 21:44:26 +00:00
|
|
|
setuidPrograms =
|
2007-11-09 18:49:45 +00:00
|
|
|
config.security.setuidPrograms ++
|
|
|
|
config.security.extraSetuidPrograms ++
|
|
|
|
pkgs.lib.optional (config.security.sudo.enable) "sudo";
|
2006-12-09 19:25:23 +00:00
|
|
|
|
2007-06-08 15:41:12 +00:00
|
|
|
inherit (usersGroups) createUsersGroups usersList groupsList;
|
|
|
|
|
2006-12-16 21:48:12 +00:00
|
|
|
path = [
|
|
|
|
pkgs.coreutils pkgs.gnugrep pkgs.findutils
|
|
|
|
pkgs.glibc # needed for getent
|
|
|
|
pkgs.pwdutils
|
|
|
|
];
|
2007-03-20 10:40:45 +00:00
|
|
|
|
|
|
|
bash = pkgs.bashInteractive;
|
2006-12-09 19:25:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-11-04 00:01:13 +00:00
|
|
|
# The init script of boot stage 2, which is supposed to do
|
|
|
|
# everything else to bring up the system.
|
2006-11-28 10:45:21 +00:00
|
|
|
bootStage2 = import ../boot/boot-stage-2.nix {
|
2007-03-06 00:45:33 +00:00
|
|
|
inherit (pkgs) substituteAll writeText coreutils
|
2007-06-23 15:48:09 +00:00
|
|
|
utillinux udev upstart;
|
2007-09-18 15:06:24 +00:00
|
|
|
inherit kernel activateConfiguration;
|
2007-11-09 18:49:45 +00:00
|
|
|
readOnlyRoot = config.boot.readOnlyRoot;
|
2006-12-10 22:29:44 +00:00
|
|
|
upstartPath = [
|
|
|
|
pkgs.coreutils
|
|
|
|
pkgs.findutils
|
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.gnused
|
2006-12-11 00:52:36 +00:00
|
|
|
pkgs.upstart
|
2006-12-10 22:29:44 +00:00
|
|
|
];
|
2007-11-09 18:49:45 +00:00
|
|
|
bootLocal = config.boot.localCommands;
|
2006-11-27 16:26:51 +00:00
|
|
|
};
|
|
|
|
|
2006-12-11 17:36:57 +00:00
|
|
|
|
|
|
|
# Script to build the Grub menu containing the current and previous
|
|
|
|
# system configurations.
|
|
|
|
grubMenuBuilder = pkgs.substituteAll {
|
|
|
|
src = ../installer/grub-menu-builder.sh;
|
|
|
|
isExecutable = true;
|
|
|
|
inherit (pkgs) bash;
|
|
|
|
path = [pkgs.coreutils pkgs.gnused pkgs.gnugrep];
|
2008-01-04 15:02:31 +00:00
|
|
|
inherit (config.boot) copyKernels extraGrubEntries
|
2008-01-10 04:43:19 +00:00
|
|
|
grubSplashImage bootMount configurationLimit;
|
2006-12-11 17:36:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
# Putting it all together. This builds a store object containing
|
|
|
|
# symlinks to the various parts of the built configuration (the
|
|
|
|
# kernel, the Upstart services, the init scripts, etc.) as well as a
|
|
|
|
# script `switch-to-configuration' that activates the configuration
|
|
|
|
# and makes it bootable.
|
2007-09-25 19:00:20 +00:00
|
|
|
system = pkgs.checker (pkgs.stdenv.mkDerivation {
|
2006-12-11 17:36:57 +00:00
|
|
|
name = "system";
|
|
|
|
builder = ./system.sh;
|
|
|
|
switchToConfiguration = ./switch-to-configuration.sh;
|
2007-09-27 12:24:05 +00:00
|
|
|
inherit (pkgs) grub coreutils gnused gnugrep diffutils findutils upstart;
|
2007-11-09 18:49:45 +00:00
|
|
|
grubDevice = config.boot.grubDevice;
|
2006-12-11 17:36:57 +00:00
|
|
|
kernelParams =
|
2007-11-09 18:49:45 +00:00
|
|
|
(config.boot.kernelParams) ++
|
|
|
|
(config.boot.extraKernelParams);
|
2006-12-11 17:36:57 +00:00
|
|
|
inherit bootStage2;
|
|
|
|
inherit activateConfiguration;
|
|
|
|
inherit grubMenuBuilder;
|
|
|
|
inherit etc;
|
2007-03-20 13:01:53 +00:00
|
|
|
inherit systemPath;
|
2007-09-18 15:06:24 +00:00
|
|
|
kernel = kernel + "/vmlinuz";
|
2006-12-11 17:36:57 +00:00
|
|
|
initrd = initialRamdisk + "/initrd";
|
|
|
|
# Most of these are needed by grub-install.
|
2006-12-18 16:27:56 +00:00
|
|
|
path = [
|
|
|
|
pkgs.coreutils
|
|
|
|
pkgs.gnused
|
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.findutils
|
|
|
|
pkgs.diffutils
|
|
|
|
pkgs.upstart # for initctl
|
|
|
|
];
|
2007-12-20 11:36:30 +00:00
|
|
|
children = map (x: ((import ./system.nix)
|
2007-12-31 08:52:59 +00:00
|
|
|
{inherit platform stage2Init;
|
|
|
|
configuration = x//{boot=((x.boot)//{grubDevice = "";});};}).system)
|
2007-12-20 11:36:30 +00:00
|
|
|
config.nesting.children;
|
2007-11-09 18:49:45 +00:00
|
|
|
configurationName = config.boot.configurationName;
|
2008-01-15 16:05:51 +00:00
|
|
|
}) (pkgs.lib.getAttr ["environment" "checkConfigurationOptions"]
|
|
|
|
optionDeclarations.environment.checkConfigurationOptions.default
|
|
|
|
configuration)
|
|
|
|
optionDeclarations configuration ;
|
2006-11-02 17:56:50 +00:00
|
|
|
}
|