2006-12-11 09:36:57 -08:00
|
|
|
{ platform ? __currentSystem
|
2006-12-11 08:10:23 -08:00
|
|
|
, configuration
|
2009-03-25 08:47:29 -07:00
|
|
|
, nixpkgs ? ../../nixpkgs
|
2006-11-12 10:48:47 -08:00
|
|
|
}:
|
2006-11-04 04:00:05 -08:00
|
|
|
|
2006-11-02 09:56:50 -08:00
|
|
|
rec {
|
2008-08-08 12:07:07 -07:00
|
|
|
|
2008-08-06 10:39:05 -07:00
|
|
|
configComponents = [
|
|
|
|
configuration
|
2008-08-08 11:56:58 -07:00
|
|
|
(import ./options.nix)
|
2009-01-02 08:06:52 -08:00
|
|
|
systemPathList
|
2008-08-06 10:39:05 -07:00
|
|
|
];
|
|
|
|
|
2006-12-11 07:47:30 -08:00
|
|
|
# Make a configuration object from which we can retrieve option
|
|
|
|
# values.
|
2008-08-06 10:39:05 -07:00
|
|
|
config =
|
2008-11-09 08:44:31 -08:00
|
|
|
pkgs.lib.fixOptionSets
|
2009-01-25 07:48:43 -08:00
|
|
|
pkgs.lib.newMergeOptionSets
|
2008-08-06 10:39:05 -07:00
|
|
|
pkgs configComponents;
|
2007-11-09 10:49:45 -08:00
|
|
|
|
2008-08-06 10:39:05 -07:00
|
|
|
optionDeclarations =
|
2008-11-09 08:44:31 -08:00
|
|
|
pkgs.lib.fixOptionSetsFun
|
2008-08-06 11:43:53 -07:00
|
|
|
pkgs.lib.filterOptionSets
|
|
|
|
pkgs configComponents
|
|
|
|
config;
|
2006-12-11 07:47:30 -08:00
|
|
|
|
2009-03-25 08:47:29 -07:00
|
|
|
pkgs = import nixpkgs {system = platform;};
|
2006-11-02 09:56:50 -08:00
|
|
|
|
2007-11-09 10:49:45 -08:00
|
|
|
manifests = config.installer.manifests; # exported here because nixos-rebuild uses it
|
2007-08-15 05:01:20 -07:00
|
|
|
|
2008-08-08 11:57:07 -07:00
|
|
|
nix = config.environment.nix;
|
2006-11-17 08:38:24 -08:00
|
|
|
|
2008-08-08 11:57:07 -07:00
|
|
|
kernelPackages = config.boot.kernelPackages;
|
2008-05-22 04:59:46 -07:00
|
|
|
|
|
|
|
kernel = kernelPackages.kernel;
|
2006-11-02 14:48:01 -08:00
|
|
|
|
2008-11-18 10:00:09 -08:00
|
|
|
modulesTree = config.system.modulesTree;
|
2008-05-08 08:36:56 -07:00
|
|
|
|
2006-11-02 16:36:08 -08:00
|
|
|
|
2008-08-08 10:34:30 -07:00
|
|
|
# The initial ramdisk.
|
|
|
|
initialRamdiskStuff = import ../boot/boot-stage-1.nix {
|
2008-11-22 17:29:20 -08:00
|
|
|
inherit pkgs config;
|
2006-11-02 09:56:50 -08:00
|
|
|
};
|
|
|
|
|
2008-08-08 10:34:30 -07:00
|
|
|
initialRamdisk = initialRamdiskStuff.initialRamdisk;
|
|
|
|
|
2006-11-02 14:48:01 -08:00
|
|
|
|
2008-02-08 07:59:15 -08:00
|
|
|
# NixOS installation/updating tools.
|
|
|
|
nixosTools = import ../installer {
|
2008-11-22 17:29:20 -08:00
|
|
|
inherit pkgs config;
|
2007-02-06 05:09:25 -08:00
|
|
|
};
|
|
|
|
|
2006-11-08 01:31:45 -08:00
|
|
|
|
2007-01-15 09:19:41 -08:00
|
|
|
# NSS modules. Hacky!
|
2008-11-18 10:00:09 -08:00
|
|
|
nssModules = config.system.nssModules.list;
|
2007-01-15 09:19:41 -08:00
|
|
|
|
2008-11-18 10:00:09 -08:00
|
|
|
nssModulesPath = config.system.nssModules.path;
|
2007-01-15 09:19:41 -08:00
|
|
|
|
|
|
|
|
2007-03-03 17:16:24 -08:00
|
|
|
# Wrapper around modprobe to set the path to the modules.
|
2008-11-18 10:00:09 -08:00
|
|
|
modprobe = config.system.sbin.modprobe;
|
2007-03-03 17:16:24 -08:00
|
|
|
|
|
|
|
|
2007-11-15 09:16:16 -08:00
|
|
|
# Environment variables for running Nix.
|
2008-11-18 10:00:09 -08:00
|
|
|
nixEnvVars = config.nix.envVars;
|
2007-11-15 09:16:16 -08:00
|
|
|
|
2009-01-02 08:06:52 -08:00
|
|
|
|
2006-12-11 07:32:10 -08:00
|
|
|
# The static parts of /etc.
|
2009-01-02 08:06:52 -08:00
|
|
|
etc = config.system.build.etc;
|
2006-12-08 18:51:42 -08:00
|
|
|
|
2008-08-08 12:07:07 -07:00
|
|
|
|
2007-10-05 00:25:13 -07:00
|
|
|
# Font aggregation
|
2009-01-02 08:07:39 -08:00
|
|
|
fontDir = config.system.build.x11Fonts;
|
2006-12-11 07:47:30 -08:00
|
|
|
|
2008-08-08 12:07:07 -07:00
|
|
|
|
2006-12-11 07:47:30 -08:00
|
|
|
# The wrapper setuid programs (since we can't have setuid programs
|
2007-01-15 06:43:56 -08:00
|
|
|
# in the Nix store).
|
2009-01-02 08:06:52 -08:00
|
|
|
wrapperDir = config.system.wrapperDir;
|
2007-01-15 06:43:56 -08:00
|
|
|
|
2006-11-28 09:34:27 -08:00
|
|
|
setuidWrapper = import ../helpers/setuid {
|
|
|
|
inherit (pkgs) stdenv;
|
2007-01-15 06:43:56 -08:00
|
|
|
inherit wrapperDir;
|
2006-11-28 09:34:27 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-08-06 08:48:12 -07:00
|
|
|
# A patched `mount' command that looks in a directory in the Nix
|
|
|
|
# store instead of in /sbin for mount helpers (like mount.ntfs-3g or
|
|
|
|
# mount.cifs).
|
2008-11-18 10:00:09 -08:00
|
|
|
mount = config.system.sbin.mount;
|
2008-08-06 08:48:12 -07:00
|
|
|
|
|
|
|
|
2006-12-09 11:25:23 -08:00
|
|
|
# The packages you want in the boot environment.
|
2009-01-02 08:06:52 -08:00
|
|
|
# This have to be split up.
|
|
|
|
systemPathList = {
|
|
|
|
system = {
|
|
|
|
overridePath = [
|
|
|
|
# Better leave them here - they are small, needed,
|
|
|
|
# and hard to refer from anywhere outside.
|
|
|
|
modprobe # must take precedence over module_init_tools
|
|
|
|
mount # must take precedence over util-linux
|
|
|
|
nix
|
|
|
|
nixosTools.nixosInstall
|
|
|
|
nixosTools.nixosRebuild
|
|
|
|
nixosTools.nixosCheckout
|
|
|
|
nixosTools.nixosHardwareScan
|
|
|
|
nixosTools.nixosGenSeccureKeys
|
|
|
|
setuidWrapper
|
|
|
|
];
|
|
|
|
path =
|
|
|
|
pkgs.lib.optionals (!config.environment.cleanStart) [
|
2009-04-13 04:15:19 -07:00
|
|
|
pkgs.acl
|
|
|
|
pkgs.attr
|
2009-01-02 08:06:52 -08:00
|
|
|
pkgs.bashInteractive # bash with ncurses support
|
|
|
|
pkgs.bzip2
|
|
|
|
pkgs.coreutils
|
|
|
|
pkgs.cpio
|
|
|
|
pkgs.curl
|
|
|
|
pkgs.e2fsprogs
|
|
|
|
pkgs.findutils
|
|
|
|
pkgs.glibc # for ldd, getent
|
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.gnused
|
|
|
|
pkgs.gnutar
|
|
|
|
pkgs.grub
|
|
|
|
pkgs.gzip
|
|
|
|
pkgs.iputils
|
|
|
|
pkgs.less
|
2009-04-13 04:15:19 -07:00
|
|
|
pkgs.libcap
|
2009-01-02 08:06:52 -08:00
|
|
|
pkgs.lvm2
|
|
|
|
pkgs.man
|
|
|
|
pkgs.mdadm
|
|
|
|
pkgs.module_init_tools
|
|
|
|
pkgs.nano
|
|
|
|
pkgs.ncurses
|
|
|
|
pkgs.netcat
|
|
|
|
pkgs.nettools
|
|
|
|
pkgs.ntp
|
|
|
|
pkgs.openssh
|
|
|
|
pkgs.pciutils
|
|
|
|
pkgs.perl
|
|
|
|
pkgs.procps
|
|
|
|
pkgs.pwdutils
|
|
|
|
pkgs.reiserfsprogs
|
|
|
|
pkgs.rsync
|
|
|
|
pkgs.seccureUser
|
|
|
|
pkgs.strace
|
|
|
|
pkgs.su
|
|
|
|
pkgs.sysklogd
|
|
|
|
pkgs.sysvtools
|
|
|
|
pkgs.time
|
|
|
|
pkgs.udev
|
|
|
|
pkgs.upstart
|
|
|
|
pkgs.usbutils
|
|
|
|
pkgs.utillinux
|
|
|
|
pkgs.wirelesstools
|
2009-04-08 06:41:33 -07:00
|
|
|
(import ../helpers/info-wrapper.nix {inherit (pkgs) bash texinfo writeScriptBin;})
|
2009-01-02 08:06:52 -08:00
|
|
|
]
|
|
|
|
++ pkgs.lib.optional config.services.bitlbee.enable pkgs.bitlbee
|
|
|
|
++ pkgs.lib.optional config.networking.defaultMailServer.directDelivery pkgs.ssmtp
|
|
|
|
++ config.environment.extraPackages
|
|
|
|
++ pkgs.lib.optional config.fonts.enableFontDir fontDir
|
|
|
|
|
|
|
|
# NSS modules need to be in `systemPath' so that (i) the builder
|
|
|
|
# chroot gets to seem them, and (ii) applications can benefit from
|
|
|
|
# changes in the list of NSS modules at run-time, without requiring
|
|
|
|
# a reboot.
|
|
|
|
++ nssModules;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2006-12-09 11:25:23 -08:00
|
|
|
|
2007-01-15 06:43:56 -08: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.
|
2009-01-02 08:06:52 -08:00
|
|
|
systemPath = config.system.path;
|
2007-01-15 06:43:56 -08:00
|
|
|
|
2007-03-20 06:30:14 -07:00
|
|
|
|
2009-01-02 08:06:52 -08:00
|
|
|
defaultShell = config.system.shell;
|
|
|
|
|
2007-03-20 06:30:14 -07:00
|
|
|
|
2006-12-09 11:25:23 -08: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').
|
2009-01-02 08:07:24 -08:00
|
|
|
activateConfiguration = config.system.activationScripts.script;
|
2006-12-09 11:25:23 -08:00
|
|
|
|
2009-01-02 11:41:39 -08:00
|
|
|
# The shell that we want to use for /bin/sh.
|
|
|
|
binsh = pkgs.bashInteractive;
|
|
|
|
|
2006-12-09 11:25:23 -08:00
|
|
|
|
2006-11-03 16:01:13 -08:00
|
|
|
# The init script of boot stage 2, which is supposed to do
|
|
|
|
# everything else to bring up the system.
|
2009-01-02 08:07:30 -08:00
|
|
|
bootStage2 = config.system.build.bootStage2;
|
2006-11-27 08:26:51 -08:00
|
|
|
|
2006-12-11 09:36:57 -08:00
|
|
|
|
|
|
|
# Script to build the Grub menu containing the current and previous
|
|
|
|
# system configurations.
|
2009-01-02 08:07:34 -08:00
|
|
|
grubMenuBuilder = config.system.build.grubMenuBuilder;
|
2006-12-11 09:36:57 -08: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 12:00:20 -07:00
|
|
|
system = pkgs.checker (pkgs.stdenv.mkDerivation {
|
2006-12-11 09:36:57 -08:00
|
|
|
name = "system";
|
|
|
|
builder = ./system.sh;
|
|
|
|
switchToConfiguration = ./switch-to-configuration.sh;
|
2007-09-27 05:24:05 -07:00
|
|
|
inherit (pkgs) grub coreutils gnused gnugrep diffutils findutils upstart;
|
2007-11-09 10:49:45 -08:00
|
|
|
grubDevice = config.boot.grubDevice;
|
2006-12-11 09:36:57 -08:00
|
|
|
kernelParams =
|
2008-01-24 08:56:09 -08:00
|
|
|
config.boot.kernelParams ++ config.boot.extraKernelParams;
|
2006-12-11 09:36:57 -08:00
|
|
|
inherit bootStage2;
|
|
|
|
inherit activateConfiguration;
|
|
|
|
inherit grubMenuBuilder;
|
|
|
|
inherit etc;
|
2007-03-20 06:01:53 -07:00
|
|
|
inherit systemPath;
|
2007-09-18 08:06:24 -07:00
|
|
|
kernel = kernel + "/vmlinuz";
|
2006-12-11 09:36:57 -08:00
|
|
|
initrd = initialRamdisk + "/initrd";
|
|
|
|
# Most of these are needed by grub-install.
|
2006-12-18 08:27:56 -08:00
|
|
|
path = [
|
|
|
|
pkgs.coreutils
|
|
|
|
pkgs.gnused
|
|
|
|
pkgs.gnugrep
|
|
|
|
pkgs.findutils
|
|
|
|
pkgs.diffutils
|
|
|
|
pkgs.upstart # for initctl
|
|
|
|
];
|
2009-04-28 06:38:22 -07:00
|
|
|
upstartInterfaceVersion = pkgs.upstart.interfaceVersion;
|
2009-04-05 12:13:52 -07: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
|
2007-12-20 03:36:30 -08:00
|
|
|
children = map (x: ((import ./system.nix)
|
2008-08-08 08:49:57 -07:00
|
|
|
{ inherit platform;
|
2007-12-31 00:52:59 -08:00
|
|
|
configuration = x//{boot=((x.boot)//{grubDevice = "";});};}).system)
|
2007-12-20 03:36:30 -08:00
|
|
|
config.nesting.children;
|
2007-11-09 10:49:45 -08:00
|
|
|
configurationName = config.boot.configurationName;
|
2008-08-06 10:39:05 -07:00
|
|
|
}) config.environment.checkConfigurationOptions
|
|
|
|
optionDeclarations config;
|
2008-08-08 12:07:07 -07:00
|
|
|
|
2006-11-02 09:56:50 -08:00
|
|
|
}
|