2006-12-11 18:36:57 +01:00
|
|
|
{ platform ? __currentSystem
|
|
|
|
, stage2Init ? ""
|
2006-12-11 17:10:23 +01:00
|
|
|
, configuration
|
2006-11-12 19:48:47 +01:00
|
|
|
}:
|
2006-11-04 13:00:05 +01:00
|
|
|
|
2006-11-02 18:56:50 +01:00
|
|
|
rec {
|
|
|
|
|
2006-12-11 16:47:30 +01:00
|
|
|
# Make a configuration object from which we can retrieve option
|
|
|
|
# values.
|
2007-11-09 19:49:45 +01:00
|
|
|
config = pkgs.lib.addDefaultOptionValues optionDeclarations configuration;
|
|
|
|
|
|
|
|
optionDeclarations = import ./options.nix {inherit pkgs; inherit (pkgs.lib) mkOption;};
|
|
|
|
|
2006-12-11 16:47:30 +01:00
|
|
|
|
2006-12-11 18:36:57 +01:00
|
|
|
pkgs = import ../pkgs/top-level/all-packages.nix {system = platform;};
|
2006-11-02 18:56:50 +01:00
|
|
|
|
2006-11-28 11:45:21 +01:00
|
|
|
pkgsDiet = import ../pkgs/top-level/all-packages.nix {
|
2006-12-11 18:36:57 +01:00
|
|
|
system = platform;
|
2006-11-02 23:48:01 +01:00
|
|
|
bootStdenv = pkgs.useDietLibC pkgs.stdenv;
|
|
|
|
};
|
|
|
|
|
2006-11-28 11:45:21 +01:00
|
|
|
pkgsStatic = import ../pkgs/top-level/all-packages.nix {
|
2006-12-11 18:36:57 +01:00
|
|
|
system = platform;
|
2006-11-03 14:35:02 +01:00
|
|
|
bootStdenv = pkgs.makeStaticBinaries pkgs.stdenv;
|
|
|
|
};
|
|
|
|
|
2006-11-28 11:45:21 +01:00
|
|
|
stdenvLinuxStuff = import ../pkgs/stdenv/linux {
|
2006-11-02 18:56:50 +01:00
|
|
|
system = pkgs.stdenv.system;
|
2006-11-28 11:45:21 +01:00
|
|
|
allPackages = import ../pkgs/top-level/all-packages.nix;
|
2006-11-02 18:56:50 +01:00
|
|
|
};
|
|
|
|
|
2007-11-09 19:49:45 +01:00
|
|
|
manifests = config.installer.manifests; # exported here because nixos-rebuild uses it
|
2007-08-15 14:01:20 +02:00
|
|
|
|
2007-11-13 16:51:24 +01:00
|
|
|
nix = config.environment.nix pkgs;
|
2006-11-17 17:38:24 +01:00
|
|
|
|
2007-11-09 19:12:23 +01:00
|
|
|
kernel = config.boot.kernel pkgs;
|
2006-11-02 23:48:01 +01:00
|
|
|
|
2006-12-19 23:12:44 +01:00
|
|
|
rootModules =
|
2007-11-09 19:12:23 +01:00
|
|
|
config.boot.initrd.extraKernelModules ++
|
|
|
|
config.boot.initrd.kernelModules;
|
2006-12-19 23:12:44 +01:00
|
|
|
|
|
|
|
|
2006-11-03 01:36:08 +01:00
|
|
|
# Determine the set of modules that we need to mount the root FS.
|
2008-03-17 11:51:09 +01:00
|
|
|
modulesClosure = pkgs.makeModulesClosure {
|
2008-01-29 19:53:15 +01:00
|
|
|
inherit rootModules;
|
|
|
|
kernel = modulesTree;
|
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.
|
2006-12-10 23:43:04 +01:00
|
|
|
extraUtils = pkgs.runCommand "extra-utils"
|
|
|
|
{ buildInputs = [pkgs.nukeReferences];
|
|
|
|
inherit (pkgsStatic) utillinux;
|
2007-01-10 13:42:28 +01:00
|
|
|
inherit (pkgsDiet) udev;
|
2006-12-10 23:43:04 +01:00
|
|
|
e2fsprogs = pkgs.e2fsprogsDiet;
|
2007-11-09 19:49:45 +01: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 13:42:28 +01:00
|
|
|
allowedReferences = []; # prevent accidents like glibc being included in the initrd
|
2006-12-10 23:43:04 +01:00
|
|
|
}
|
2008-03-17 11:51:09 +01:00
|
|
|
''
|
2006-11-24 13:13:11 +01:00
|
|
|
ensureDir $out/bin
|
2008-03-17 11:51:09 +01:00
|
|
|
if test -n "$devicemapper"; then
|
2007-06-28 11:57:36 +02:00
|
|
|
cp $devicemapper/sbin/dmsetup.static $out/bin/dmsetup
|
|
|
|
cp $lvm2/sbin/lvm.static $out/bin/lvm
|
|
|
|
fi
|
2006-11-24 13:13:11 +01: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 13:42:28 +01:00
|
|
|
cp $udev/sbin/udevd $udev/sbin/udevtrigger $udev/sbin/udevsettle $out/bin
|
2006-11-24 13:13:11 +01:00
|
|
|
nuke-refs $out/bin/*
|
2008-03-17 11:51:09 +01:00
|
|
|
'';
|
2006-11-03 14:35:02 +01:00
|
|
|
|
|
|
|
|
2006-11-02 23:48:01 +01:00
|
|
|
# The init script of boot stage 1 (loading kernel modules for
|
|
|
|
# mounting the root FS).
|
2006-11-28 11:45:21 +01:00
|
|
|
bootStage1 = import ../boot/boot-stage-1.nix {
|
2006-12-10 23:29:44 +01:00
|
|
|
inherit (pkgs) substituteAll;
|
2006-11-03 12:47:40 +01:00
|
|
|
inherit (pkgsDiet) module_init_tools;
|
2006-11-03 14:35:02 +01:00
|
|
|
inherit extraUtils;
|
2008-01-24 17:56:09 +01:00
|
|
|
inherit (config.boot) autoDetectRootDevice isLiveCD;
|
2007-02-06 17:53:36 +01:00
|
|
|
fileSystems =
|
|
|
|
pkgs.lib.filter
|
|
|
|
(fs: fs.mountPoint == "/" || (fs ? neededForBoot && fs.neededForBoot))
|
2007-11-09 19:49:45 +01:00
|
|
|
(config.fileSystems);
|
|
|
|
rootLabel = config.boot.rootLabel;
|
2006-11-13 12:41:27 +01:00
|
|
|
inherit stage2Init;
|
2006-12-19 23:12:44 +01:00
|
|
|
modulesDir = modulesClosure;
|
|
|
|
modules = rootModules;
|
2006-12-10 23:29:44 +01:00
|
|
|
staticShell = stdenvLinuxStuff.bootstrapTools.bash;
|
2006-11-02 23:48:01 +01:00
|
|
|
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.
|
2008-03-17 11:51:09 +01:00
|
|
|
initialRamdisk = pkgs.makeInitrd {
|
2006-11-27 02:35:34 +01:00
|
|
|
contents = [
|
|
|
|
{ object = bootStage1;
|
|
|
|
symlink = "/init";
|
|
|
|
}
|
2007-11-09 19:49:45 +01:00
|
|
|
] ++ (if config.boot.initrd.enableSplashScreen then [
|
2008-03-17 11:51:09 +01:00
|
|
|
{ object = pkgs.runCommand "splashutils" {} ''
|
2007-01-23 14:44:41 +01:00
|
|
|
ensureDir $out/bin
|
|
|
|
cp ${pkgs.splashutils}/bin/splash_helper $out/bin
|
2008-03-17 11:51:09 +01:00
|
|
|
'';
|
2006-11-27 02:35:34 +01:00
|
|
|
suffix = "/bin/splash_helper";
|
|
|
|
symlink = "/sbin/splash_helper";
|
|
|
|
}
|
2006-11-28 11:45:21 +01:00
|
|
|
{ object = import ../helpers/unpack-theme.nix {
|
2006-11-27 02:35:34 +01:00
|
|
|
inherit (pkgs) stdenv;
|
2007-11-09 19:49:45 +01:00
|
|
|
theme = config.services.ttyBackgrounds.defaultTheme;
|
2006-11-27 02:35:34 +01:00
|
|
|
};
|
|
|
|
symlink = "/etc/splash";
|
|
|
|
}
|
2007-01-22 19:58:04 +01:00
|
|
|
] else []);
|
2006-11-02 18:56:50 +01:00
|
|
|
};
|
|
|
|
|
2006-11-02 23:48:01 +01:00
|
|
|
|
2008-02-08 16:59:15 +01:00
|
|
|
# NixOS installation/updating tools.
|
|
|
|
nixosTools = import ../installer {
|
|
|
|
inherit pkgs config nix;
|
2007-02-06 14:09:25 +01:00
|
|
|
};
|
|
|
|
|
2006-11-08 10:31:45 +01:00
|
|
|
|
2007-01-15 18:19:41 +01:00
|
|
|
# NSS modules. Hacky!
|
2007-01-16 17:09:43 +01:00
|
|
|
nssModules =
|
2008-03-17 14:58:57 +01:00
|
|
|
pkgs.lib.optional config.users.ldap.enable pkgs.nss_ldap
|
|
|
|
++ pkgs.lib.optional config.services.avahi.nssmdns pkgs.nssmdns;
|
2007-01-15 18:19:41 +01:00
|
|
|
|
|
|
|
nssModulesPath = pkgs.lib.concatStrings (pkgs.lib.intersperse ":"
|
|
|
|
(map (mod: mod + "/lib") nssModules));
|
|
|
|
|
|
|
|
|
2008-01-13 00:37:17 +01: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 (
|
2008-01-25 13:54:27 +01:00
|
|
|
[kernel]
|
2008-01-29 19:53:15 +01:00
|
|
|
++ pkgs.lib.optional config.networking.enableIntel3945ABGFirmware pkgs.iwlwifi
|
2008-02-18 17:50:08 +01:00
|
|
|
++ pkgs.lib.optional config.networking.enableIntel4965AGNFirmware pkgs.iwlwifi
|
2008-01-13 00:37:17 +01:00
|
|
|
# !!! this should be declared by the xserver Upstart job.
|
|
|
|
++ pkgs.lib.optional (config.services.xserver.enable && config.services.xserver.videoDriver == "nvidia") pkgs.nvidiaDrivers
|
2008-02-04 11:52:58 +01:00
|
|
|
++ pkgs.lib.optional config.hardware.enableGo7007 pkgs.wis_go7007
|
2008-01-29 19:53:15 +01:00
|
|
|
++ config.boot.extraModulePackages
|
2008-01-13 00:37:17 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
2007-03-04 02:16:24 +01:00
|
|
|
# Wrapper around modprobe to set the path to the modules.
|
|
|
|
modprobe = pkgs.substituteAll {
|
|
|
|
dir = "sbin";
|
|
|
|
src = ./modprobe;
|
|
|
|
isExecutable = true;
|
2007-06-23 17:48:09 +02:00
|
|
|
inherit (pkgs) module_init_tools;
|
2008-01-13 00:37:17 +01:00
|
|
|
inherit modulesTree;
|
2007-03-04 02:16:24 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2007-11-15 18:16:16 +01: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 21:07:45 +01:00
|
|
|
# The services (Upstart) configuration for the system.
|
2007-03-30 14:59:43 +02:00
|
|
|
upstartJobs = import ../upstart-jobs/default.nix {
|
2008-03-16 02:05:40 +01:00
|
|
|
inherit config pkgs nix modprobe nssModulesPath nixEnvVars optionDeclarations;
|
2006-11-19 22:03:22 +01:00
|
|
|
};
|
|
|
|
|
2006-12-09 03:51:42 +01:00
|
|
|
|
2006-12-11 16:32:10 +01:00
|
|
|
# The static parts of /etc.
|
2007-03-30 14:59:43 +02:00
|
|
|
etc = import ../etc/default.nix {
|
2007-11-15 18:16:16 +01:00
|
|
|
inherit config pkgs upstartJobs systemPath wrapperDir
|
2008-03-17 14:58:57 +01:00
|
|
|
defaultShell nixEnvVars modulesTree nssModulesPath;
|
2007-03-30 14:55:09 +02:00
|
|
|
extraEtc = pkgs.lib.concatLists (map (job: job.extraEtc) upstartJobs.jobs);
|
2006-12-09 03:51:42 +01:00
|
|
|
};
|
|
|
|
|
2007-10-05 09:25:13 +02:00
|
|
|
# Font aggregation
|
2007-11-15 18:16:16 +01:00
|
|
|
fontDir = import ./fontdir.nix {
|
2008-01-25 14:31:59 +01:00
|
|
|
inherit config pkgs ;
|
2008-03-02 19:46:57 +01:00
|
|
|
inherit (pkgs) builderDefs ttmkfdir;
|
2007-11-15 18:16:16 +01:00
|
|
|
inherit (pkgs.xorg) mkfontdir mkfontscale fontalias;
|
|
|
|
};
|
2006-12-11 16:47:30 +01:00
|
|
|
|
|
|
|
# The wrapper setuid programs (since we can't have setuid programs
|
2007-01-15 15:43:56 +01:00
|
|
|
# in the Nix store).
|
|
|
|
wrapperDir = "/var/setuid-wrappers";
|
|
|
|
|
2006-11-28 18:34:27 +01:00
|
|
|
setuidWrapper = import ../helpers/setuid {
|
|
|
|
inherit (pkgs) stdenv;
|
2007-01-15 15:43:56 +01:00
|
|
|
inherit wrapperDir;
|
2006-11-28 18:34:27 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-12-09 20:25:23 +01:00
|
|
|
# The packages you want in the boot environment.
|
2008-02-08 16:59:15 +01:00
|
|
|
systemPathList = [
|
2008-01-22 18:55:57 +01:00
|
|
|
# Better leave them here - they are small, needed,
|
|
|
|
# and hard to refer from anywhere outside.
|
2008-02-08 16:59:15 +01:00
|
|
|
modprobe # must take precedence over module_init_tools
|
2008-01-22 18:55:57 +01:00
|
|
|
nix
|
2008-02-08 16:59:15 +01:00
|
|
|
nixosTools.nixosInstall
|
|
|
|
nixosTools.nixosRebuild
|
|
|
|
nixosTools.nixosCheckout
|
|
|
|
nixosTools.nixosHardwareScan
|
2008-03-04 00:30:49 +01:00
|
|
|
nixosTools.nixosGenSeccureKeys
|
2008-01-22 18:55:57 +01:00
|
|
|
setuidWrapper
|
|
|
|
]
|
2008-02-08 16:59:15 +01:00
|
|
|
++ pkgs.lib.optionals (!config.environment.cleanStart) [
|
2007-03-20 11:40:45 +01:00
|
|
|
pkgs.bashInteractive # bash with ncurses support
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.bzip2
|
|
|
|
pkgs.coreutils
|
|
|
|
pkgs.cpio
|
2007-01-10 18:09:00 +01:00
|
|
|
pkgs.cron
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.curl
|
|
|
|
pkgs.e2fsprogs
|
|
|
|
pkgs.findutils
|
2006-12-23 23:43:39 +01:00
|
|
|
pkgs.glibc # for ldd, getent
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.gnused
|
|
|
|
pkgs.gnutar
|
|
|
|
pkgs.grub
|
|
|
|
pkgs.gzip
|
|
|
|
pkgs.iputils
|
|
|
|
pkgs.less
|
2006-12-24 02:07:28 +01:00
|
|
|
pkgs.lvm2
|
2008-02-07 15:39:32 +01:00
|
|
|
pkgs.man
|
2007-01-11 01:06:46 +01:00
|
|
|
pkgs.mdadm
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.module_init_tools
|
|
|
|
pkgs.nano
|
|
|
|
pkgs.netcat
|
|
|
|
pkgs.nettools
|
2006-12-23 23:43:39 +01:00
|
|
|
pkgs.ntp
|
2007-02-19 23:33:44 +01:00
|
|
|
pkgs.openssh
|
|
|
|
pkgs.pciutils
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.perl
|
|
|
|
pkgs.procps
|
2006-12-11 02:03:26 +01:00
|
|
|
pkgs.pwdutils
|
2007-11-07 23:00:05 +01:00
|
|
|
pkgs.reiserfsprogs
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.rsync
|
2008-03-04 00:30:49 +01:00
|
|
|
pkgs.seccureUser
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.strace
|
2007-01-11 16:32:48 +01:00
|
|
|
pkgs.su
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.sysklogd
|
2007-05-23 16:29:34 +02:00
|
|
|
pkgs.sysvtools
|
2007-04-20 10:51:41 +02:00
|
|
|
pkgs.time
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.udev
|
|
|
|
pkgs.upstart
|
2008-01-18 16:18:32 +01:00
|
|
|
pkgs.usbutils
|
2006-12-09 20:25:23 +01:00
|
|
|
pkgs.utillinux
|
2007-03-28 23:15:23 +02:00
|
|
|
pkgs.wirelesstools
|
2008-02-08 16:59:15 +01:00
|
|
|
]
|
|
|
|
++ pkgs.lib.optional config.security.sudo.enable pkgs.sudo
|
2008-02-20 23:46:53 +01:00
|
|
|
++ pkgs.lib.optional config.services.bitlbee.enable pkgs.bitlbee
|
2008-03-17 14:58:57 +01:00
|
|
|
++ pkgs.lib.optional config.services.avahi.enable pkgs.avahi
|
|
|
|
++ pkgs.lib.optional config.services.avahi.nssmdns pkgs.nssmdns
|
2008-02-08 16:59:15 +01:00
|
|
|
++ pkgs.lib.optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
|
2007-04-07 23:44:26 +02:00
|
|
|
++ pkgs.lib.concatLists (map (job: job.extraPath) upstartJobs.jobs)
|
2008-02-08 16:59:15 +01:00
|
|
|
++ config.environment.extraPackages pkgs
|
|
|
|
++ pkgs.lib.optional config.fonts.enableFontDir fontDir;
|
2006-12-09 20:25:23 +01:00
|
|
|
|
|
|
|
|
2007-01-15 15:43:56 +01: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 21:44:27 +01:00
|
|
|
inherit (config.environment) pathsToLink;
|
2007-01-15 15:43:56 +01:00
|
|
|
ignoreCollisions = true;
|
|
|
|
};
|
|
|
|
|
2007-03-20 14:30:14 +01:00
|
|
|
|
2007-11-16 14:26:34 +01:00
|
|
|
usersGroups = import ./users-groups.nix { inherit pkgs config upstartJobs defaultShell; };
|
2007-06-08 17:41:12 +02:00
|
|
|
|
|
|
|
|
2007-03-20 14:30:14 +01:00
|
|
|
defaultShell = "/var/run/current-system/sw/bin/bash";
|
|
|
|
|
2007-01-15 15:43:56 +01:00
|
|
|
|
2006-12-09 20:25:23 +01: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').
|
2008-03-17 11:31:40 +01:00
|
|
|
activateConfiguration = pkgs.substituteAll rec {
|
2006-12-09 20:25:23 +01:00
|
|
|
src = ./activate-configuration.sh;
|
|
|
|
isExecutable = true;
|
|
|
|
|
2007-09-18 17:06:24 +02:00
|
|
|
inherit etc wrapperDir systemPath modprobe defaultShell kernel;
|
2007-11-09 19:49:45 +01:00
|
|
|
hostName = config.networking.hostName;
|
2007-04-07 23:44:26 +02:00
|
|
|
setuidPrograms =
|
2007-11-09 19:49:45 +01:00
|
|
|
config.security.setuidPrograms ++
|
|
|
|
config.security.extraSetuidPrograms ++
|
|
|
|
pkgs.lib.optional (config.security.sudo.enable) "sudo";
|
2006-12-09 20:25:23 +01:00
|
|
|
|
2007-06-08 17:41:12 +02:00
|
|
|
inherit (usersGroups) createUsersGroups usersList groupsList;
|
|
|
|
|
2006-12-16 22:48:12 +01:00
|
|
|
path = [
|
2008-03-17 11:31:40 +01:00
|
|
|
pkgs.coreutils pkgs.gnugrep pkgs.findutils
|
|
|
|
pkgs.glibc # needed for getent
|
|
|
|
pkgs.pwdutils
|
|
|
|
]
|
|
|
|
|
|
|
|
# XXX: Hack to recognize common setuid programs.
|
|
|
|
++ pkgs.lib.optional (pkgs.lib.any (x: x == "xlock") setuidPrograms)
|
|
|
|
pkgs.xlockmore
|
|
|
|
++ pkgs.lib.optional (pkgs.lib.any (x: x == "xscreensaver")
|
|
|
|
setuidPrograms)
|
|
|
|
pkgs.xscreensaver
|
|
|
|
++ pkgs.lib.optional (pkgs.lib.any (x: x == "xlaunch") setuidPrograms)
|
|
|
|
pkgs.xlaunch;
|
2007-03-20 11:40:45 +01:00
|
|
|
|
|
|
|
bash = pkgs.bashInteractive;
|
2006-12-09 20:25:23 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
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.
|
2006-11-28 11:45:21 +01:00
|
|
|
bootStage2 = import ../boot/boot-stage-2.nix {
|
2007-03-06 01:45:33 +01:00
|
|
|
inherit (pkgs) substituteAll writeText coreutils
|
2007-06-23 17:48:09 +02:00
|
|
|
utillinux udev upstart;
|
2007-09-18 17:06:24 +02:00
|
|
|
inherit kernel activateConfiguration;
|
2008-01-24 17:56:09 +01:00
|
|
|
inherit (config.boot) isLiveCD;
|
2006-12-10 23:29:44 +01:00
|
|
|
upstartPath = [
|
|
|
|
pkgs.coreutils
|
|
|
|
pkgs.findutils
|
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.gnused
|
2006-12-11 01:52:36 +01:00
|
|
|
pkgs.upstart
|
2006-12-10 23:29:44 +01:00
|
|
|
];
|
2007-11-09 19:49:45 +01:00
|
|
|
bootLocal = config.boot.localCommands;
|
2006-11-27 17:26:51 +01:00
|
|
|
};
|
|
|
|
|
2006-12-11 18:36:57 +01: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 16:02:31 +01:00
|
|
|
inherit (config.boot) copyKernels extraGrubEntries
|
2008-01-10 05:43:19 +01:00
|
|
|
grubSplashImage bootMount configurationLimit;
|
2006-12-11 18:36:57 +01: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 21:00:20 +02:00
|
|
|
system = pkgs.checker (pkgs.stdenv.mkDerivation {
|
2006-12-11 18:36:57 +01:00
|
|
|
name = "system";
|
|
|
|
builder = ./system.sh;
|
|
|
|
switchToConfiguration = ./switch-to-configuration.sh;
|
2007-09-27 14:24:05 +02:00
|
|
|
inherit (pkgs) grub coreutils gnused gnugrep diffutils findutils upstart;
|
2007-11-09 19:49:45 +01:00
|
|
|
grubDevice = config.boot.grubDevice;
|
2006-12-11 18:36:57 +01:00
|
|
|
kernelParams =
|
2008-01-24 17:56:09 +01:00
|
|
|
config.boot.kernelParams ++ config.boot.extraKernelParams;
|
2006-12-11 18:36:57 +01:00
|
|
|
inherit bootStage2;
|
|
|
|
inherit activateConfiguration;
|
|
|
|
inherit grubMenuBuilder;
|
|
|
|
inherit etc;
|
2007-03-20 14:01:53 +01:00
|
|
|
inherit systemPath;
|
2007-09-18 17:06:24 +02:00
|
|
|
kernel = kernel + "/vmlinuz";
|
2006-12-11 18:36:57 +01:00
|
|
|
initrd = initialRamdisk + "/initrd";
|
|
|
|
# Most of these are needed by grub-install.
|
2006-12-18 17:27:56 +01:00
|
|
|
path = [
|
|
|
|
pkgs.coreutils
|
|
|
|
pkgs.gnused
|
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.findutils
|
|
|
|
pkgs.diffutils
|
|
|
|
pkgs.upstart # for initctl
|
|
|
|
];
|
2007-12-20 12:36:30 +01:00
|
|
|
children = map (x: ((import ./system.nix)
|
2007-12-31 09:52:59 +01:00
|
|
|
{inherit platform stage2Init;
|
|
|
|
configuration = x//{boot=((x.boot)//{grubDevice = "";});};}).system)
|
2007-12-20 12:36:30 +01:00
|
|
|
config.nesting.children;
|
2007-11-09 19:49:45 +01:00
|
|
|
configurationName = config.boot.configurationName;
|
2008-01-15 17:05:51 +01:00
|
|
|
}) (pkgs.lib.getAttr ["environment" "checkConfigurationOptions"]
|
|
|
|
optionDeclarations.environment.checkConfigurationOptions.default
|
|
|
|
configuration)
|
|
|
|
optionDeclarations configuration ;
|
2006-11-02 18:56:50 +01:00
|
|
|
}
|