* Move the definition of the set of system packages to

modules/config/system-path.nix.  system/system.nix is now almost
  empty.
* Removed the cleanStart option - it should be possible to get the
  same functionality by overriding config.system.path (or defining
  config.system.systemPackages with a higher priority - don't know if
  that works though).

svn path=/nixos/branches/modular-nixos/; revision=15727
This commit is contained in:
Eelco Dolstra 2009-05-25 17:41:03 +00:00
parent c96f0d75f0
commit 60b3f95ad8
10 changed files with 188 additions and 250 deletions

View File

@ -19,7 +19,6 @@ in
grubMenuBuilder
kernel
modulesTree
nix
system
systemPath
config
@ -40,7 +39,9 @@ in
modulesClosure
;
nixFallback = system.nix;
nix = system.config.environment.nix;
nixFallback = (import nixpkgs {}).nixUnstable;
manifests = system.config.installer.manifests; # exported here because nixos-rebuild uses it

View File

@ -0,0 +1,150 @@
# This module defines the packages that appear in
# /var/run/current-system/sw.
{pkgs, config, ...}:
with pkgs.lib;
let
# NixOS installation/updating tools.
nixosTools = import ../../installer {
inherit pkgs config;
};
systemPackages =
[ config.system.sbin.modprobe # must take precedence over module_init_tools
config.system.sbin.mount # must take precedence over util-linux
config.environment.nix
nixosTools.nixosInstall
nixosTools.nixosRebuild
nixosTools.nixosCheckout
nixosTools.nixosHardwareScan
nixosTools.nixosGenSeccureKeys
pkgs.acl
pkgs.attr
pkgs.bashInteractive # bash with ncurses support
pkgs.bzip2
pkgs.coreutils
pkgs.cpio
pkgs.curl
pkgs.e2fsprogs
pkgs.findutils
pkgs.glibc # for ldd, getent
pkgs.glibcLocales
pkgs.gnugrep
pkgs.gnused
pkgs.gnutar
pkgs.grub
pkgs.gzip
pkgs.iputils
pkgs.less
pkgs.libcap
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.seccure
pkgs.strace
pkgs.su
pkgs.sysklogd
pkgs.sysvtools
pkgs.time
pkgs.udev
pkgs.upstart
pkgs.usbutils
pkgs.utillinux
pkgs.wirelesstools
(import ../../helpers/info-wrapper.nix {inherit (pkgs) bash texinfo writeScriptBin;})
]
++ 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 config.system.build.x11Fonts
# 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.
++ config.system.nssModules.list;
options = {
environment = {
systemPackages = mkOption {
default = systemPackages;
description = ''
The set of packages that appear in
/var/run/current-system/sw. These packages are
automatically available to all users, and are
automatically updated every time you rebuild the system
configuration. (The latter is the main difference with
installing them in the default profile,
<filename>/nix/var/nix/profiles/default</filename>.
'';
};
# !!! Obsolete.
extraPackages = mkOption {
default = [];
example = [pkgs.firefox pkgs.thunderbird];
description = ''
This option allows you to add additional packages to the system
path.
'';
};
pathsToLink = mkOption {
default = ["/bin" "/sbin" "/lib" "/share/man" "/share/info" "/man" "/info"];
example = ["/"];
description = "
Lists directories to be symlinked in `/var/run/current-system/sw'.
";
};
};
system = {
path = mkOption {
default = config.environment.systemPackages;
description = ''
The packages you want in the boot environment.
'';
apply = list: pkgs.buildEnv {
name = "system-path";
paths = list;
# Note: We need `/lib' to be among `pathsToLink' for NSS modules
# to work.
inherit (config.environment) pathsToLink;
ignoreCollisions = true;
};
};
};
};
in
{
require = [options];
}

View File

@ -45,11 +45,7 @@ mkIf config.services.pulseaudio.enable {
];
environment = {
extraPackages =
pkgs.lib.optional
(!config.environment.cleanStart)
pkgs.pulseaudio;
extraPackages = [pkgs.pulseaudio];
};
users = {

View File

@ -1,11 +1,25 @@
{pkgs, config, ...}:
with pkgs.lib;
###### interface
let
inherit (pkgs.lib) mkOption mkIf;
options = {
environment = {
nix = mkOption {
default = pkgs.nixUnstable;
example = pkgs.nixCustomFun /root/nix.tar.gz;
merge = mergeOneOption;
description = "
This option specifies the Nix package instance to use throughout the system.
";
};
};
nix = {
maxJobs = mkOption {

View File

@ -58,7 +58,6 @@ in
# ? # config.time.timeZone
# ? # config.environment.etc
# ? # config.environment.extraPackages
# ? # config.environment.cleanStart
options
];
@ -71,10 +70,7 @@ in
}
];
extraPackages =
pkgs.lib.optional
(!config.environment.cleanStart)
pkgs.cron;
extraPackages = [pkgs.cron];
};
services = {

View File

@ -107,10 +107,7 @@ in
}
];
extraPackages = ifEnabled (
pkgs.lib.optional
(!config.environment.cleanStart)
pkgs.fcron);
extraPackages = ifEnabled [pkgs.fcron];
};
services = {

View File

@ -1,8 +1,6 @@
{pkgs, config, ...}:
let
inherit (pkgs.lib) mergeOneOption mkOption;
in
with pkgs.lib;
{
environment = {
@ -13,51 +11,5 @@ in
If all configuration options must be checked. Non-existing options fail build.
";
};
nix = mkOption {
default = pkgs.nixUnstable;
example = pkgs.nixCustomFun /root/nix.tar.gz;
merge = mergeOneOption;
description = "
Use non-default Nix easily. Be careful, though, not to break everything.
";
};
extraPackages = mkOption {
default = [];
example = [pkgs.firefox pkgs.thunderbird];
description = "
This option allows you to add additional packages to the system
path. These packages are automatically available to all users,
and they are automatically updated every time you rebuild the
system configuration. (The latter is the main difference with
installing them in the default profile,
<filename>/nix/var/nix/profiles/default</filename>. The value
of this option must be a function that returns a list of
packages. The function will be called with the Nix Packages
collection as its argument for convenience.
";
};
pathsToLink = mkOption {
default = ["/bin" "/sbin" "/lib" "/share/man" "/share/info" "/man" "/info"];
example = ["/"];
description = "
Lists directories to be symlinked in `/var/run/current-system/sw'.
";
};
cleanStart = mkOption {
default = false;
example = true;
description = "
There are some times when you want really small system for specific
purpose and do not want default package list. Setting
<varname>cleanStart</varname> to <literal>true</literal> allows you
to create a system with empty path - only extraPackages will be
included.
";
};
};
}

View File

@ -157,9 +157,10 @@ in
inherit (pkgs) module_init_tools;
inherit (config.system) modulesTree;
};
description = "
Path to the modprobe binary used by the system.
";
description = ''
Wrapper around modprobe that sets the path to the modules
tree.
'';
};
# !!! The mount option should not stay in /system/option.nix
@ -178,8 +179,9 @@ in
} + "/sbin";
};
description = "
Install a special version of mount to search mount tools in
unusual path.
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).
";
};
};
@ -447,6 +449,7 @@ in
../modules/system/upstart-events/ctrl-alt-delete.nix
../modules/system/upstart-events/halt.nix
../modules/system/upstart-events/maintenance-shell.nix
../modules/config/system-path.nix
../system/assertion.nix
../system/nixos-environment.nix
../system/nixos-installer.nix

View File

@ -34,31 +34,6 @@ let
builtins.head list;
};
overridePath = mkOption {
default = [];
description = ''
You should not redefine this option unless you have trouble with a
package define in <varname>path</varname>.
'';
};
path = mkOption {
default = [];
description = ''
The packages you want in the boot environment.
'';
apply = list: pkgs.buildEnv {
name = "system-path";
paths = config.system.overridePath ++ list;
# Note: We need `/lib' to be among `pathsToLink' for NSS modules
# to work.
inherit (config.environment) pathsToLink;
ignoreCollisions = true;
};
};
};
};
in

View File

@ -8,7 +8,6 @@ rec {
configComponents = [
configuration
(import ./options.nix)
systemPathList
];
# Make a configuration object from which we can retrieve option
@ -26,14 +25,6 @@ rec {
pkgs = import nixpkgs {system = platform;};
manifests = config.installer.manifests; # exported here because nixos-rebuild uses it
nix = config.environment.nix;
kernelPackages = config.boot.kernelPackages;
kernel = kernelPackages.kernel;
# The initial ramdisk.
initialRamdiskStuff = import ../modules/system/boot/stage-1.nix {
@ -43,155 +34,18 @@ rec {
initialRamdisk = initialRamdiskStuff.initialRamdisk;
# NixOS installation/updating tools.
nixosTools = import ../installer {
inherit pkgs config;
};
# NSS modules. Hacky!
nssModules = config.system.nssModules.list;
nssModulesPath = config.system.nssModules.path;
# Wrapper around modprobe to set the path to the modules.
modprobe = config.system.sbin.modprobe;
# The static parts of /etc.
etc = config.system.build.etc;
# Font aggregation
fontDir = config.system.build.x11Fonts;
# 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).
mount = config.system.sbin.mount;
# The packages you want in the boot environment.
# 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
];
path =
pkgs.lib.optionals (!config.environment.cleanStart) [
pkgs.acl
pkgs.attr
pkgs.bashInteractive # bash with ncurses support
pkgs.bzip2
pkgs.coreutils
pkgs.cpio
pkgs.curl
pkgs.e2fsprogs
pkgs.findutils
pkgs.glibc # for ldd, getent
pkgs.glibcLocales
pkgs.gnugrep
pkgs.gnused
pkgs.gnutar
pkgs.grub
pkgs.gzip
pkgs.iputils
pkgs.less
pkgs.libcap
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.seccure
pkgs.strace
pkgs.su
pkgs.sysklogd
pkgs.sysvtools
pkgs.time
pkgs.udev
pkgs.upstart
pkgs.usbutils
pkgs.utillinux
pkgs.wirelesstools
(import ../helpers/info-wrapper.nix {inherit (pkgs) bash texinfo writeScriptBin;})
]
++ 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;
};
};
# 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 = config.system.path;
defaultShell = config.system.shell;
# 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').
activateConfiguration = config.system.activationScripts.script;
# The shell that we want to use for /bin/sh.
binsh = pkgs.bashInteractive;
# The init script of boot stage 2, which is supposed to do
# everything else to bring up the system.
bootStage2 = config.system.build.bootStage2;
# Script to build the Grub menu containing the current and previous
# system configurations.
grubMenuBuilder = config.system.build.grubMenuBuilder;
# 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
children = map (x: ((import ./system.nix)
children = map (x: ((import ./system.nix)
{ inherit platform;
configuration = x//{boot=((x.boot)//{grubDevice = "";});};}).system)
config.nesting.children;
configurationName = config.boot.configurationName;
# 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
@ -205,14 +59,14 @@ rec {
grubDevice = config.boot.grubDevice;
kernelParams =
config.boot.kernelParams ++ config.boot.extraKernelParams;
inherit bootStage2;
inherit activateConfiguration;
inherit grubMenuBuilder;
inherit etc;
inherit systemPath;
bootStage2 = config.system.build.bootStage2;
activateConfiguration = config.system.activationScripts.script;
grubMenuBuilder = config.system.build.grubMenuBuilder;
etc = config.system.build.etc;
systemPath = config.system.path;
inherit children;
inherit configurationName;
kernel = kernel + "/vmlinuz";
kernel = config.boot.kernelPackages.kernel + "/vmlinuz";
initrd = initialRamdisk + "/initrd";
# Most of these are needed by grub-install.
path = [