2006-12-11 17:36:57 +00:00
|
|
|
{ platform ? __currentSystem
|
2006-12-11 16:10:23 +00:00
|
|
|
, configuration
|
2009-03-25 15:47:29 +00:00
|
|
|
, nixpkgs ? ../../nixpkgs
|
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 {
|
2008-08-08 19:07:07 +00:00
|
|
|
|
2008-08-06 17:39:05 +00:00
|
|
|
configComponents = [
|
|
|
|
configuration
|
2008-08-08 18:56:58 +00:00
|
|
|
(import ./options.nix)
|
2008-08-06 17:39:05 +00:00
|
|
|
];
|
|
|
|
|
2006-12-11 15:47:30 +00:00
|
|
|
# Make a configuration object from which we can retrieve option
|
|
|
|
# values.
|
2008-08-06 17:39:05 +00:00
|
|
|
config =
|
2008-11-09 16:44:31 +00:00
|
|
|
pkgs.lib.fixOptionSets
|
2009-05-19 14:55:17 +00:00
|
|
|
pkgs.lib.mergeOptionSets
|
2008-08-06 17:39:05 +00:00
|
|
|
pkgs configComponents;
|
2007-11-09 18:49:45 +00:00
|
|
|
|
2008-08-06 17:39:05 +00:00
|
|
|
optionDeclarations =
|
2008-11-09 16:44:31 +00:00
|
|
|
pkgs.lib.fixOptionSetsFun
|
2008-08-06 18:43:53 +00:00
|
|
|
pkgs.lib.filterOptionSets
|
|
|
|
pkgs configComponents
|
|
|
|
config;
|
2006-12-11 15:47:30 +00:00
|
|
|
|
2009-03-25 15:47:29 +00:00
|
|
|
pkgs = import nixpkgs {system = platform;};
|
2006-11-02 17:56:50 +00:00
|
|
|
|
2006-11-03 00:36:08 +00:00
|
|
|
|
2009-05-18 11:30:33 +00:00
|
|
|
# This attribute is responsible for creating boot entries for
|
|
|
|
# child configuration. They are only (directly) accessible
|
|
|
|
# when the parent configuration is boot default. For example,
|
|
|
|
# you can provide an easy way to boot the same configuration
|
|
|
|
# as you use, but with another kernel
|
2009-05-25 17:41:03 +00:00
|
|
|
children = map (x: ((import ./system.nix)
|
2009-05-18 11:30:33 +00:00
|
|
|
{ inherit platform;
|
|
|
|
configuration = x//{boot=((x.boot)//{grubDevice = "";});};}).system)
|
|
|
|
config.nesting.children;
|
2006-12-11 17:36:57 +00:00
|
|
|
|
2009-05-25 17:41:03 +00:00
|
|
|
|
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;
|
2009-05-25 17:52:43 +00:00
|
|
|
inherit (pkgs) grub upstart;
|
2007-11-09 18:49:45 +00:00
|
|
|
grubDevice = config.boot.grubDevice;
|
2006-12-11 17:36:57 +00:00
|
|
|
kernelParams =
|
2008-01-24 16:56:09 +00:00
|
|
|
config.boot.kernelParams ++ config.boot.extraKernelParams;
|
2009-05-25 17:41:03 +00:00
|
|
|
bootStage2 = config.system.build.bootStage2;
|
|
|
|
activateConfiguration = config.system.activationScripts.script;
|
|
|
|
grubMenuBuilder = config.system.build.grubMenuBuilder;
|
|
|
|
etc = config.system.build.etc;
|
|
|
|
systemPath = config.system.path;
|
2009-05-18 11:30:33 +00:00
|
|
|
inherit children;
|
2009-05-25 17:52:43 +00:00
|
|
|
configurationName = config.boot.configurationName;
|
2009-05-25 17:41:03 +00:00
|
|
|
kernel = config.boot.kernelPackages.kernel + "/vmlinuz";
|
2009-05-27 08:14:06 +00:00
|
|
|
initrd = config.system.build.initialRamdisk + "/initrd";
|
2006-12-11 17:36:57 +00:00
|
|
|
# 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
|
|
|
|
];
|
2009-04-28 13:38:22 +00:00
|
|
|
upstartInterfaceVersion = pkgs.upstart.interfaceVersion;
|
2008-08-06 17:39:05 +00:00
|
|
|
}) config.environment.checkConfigurationOptions
|
|
|
|
optionDeclarations config;
|
2008-08-08 19:07:07 +00:00
|
|
|
|
2006-11-02 17:56:50 +00:00
|
|
|
}
|