Skip to content

Commit

Permalink
* Move the definition of the set of system packages to
Browse files Browse the repository at this point in the history
  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
  • Loading branch information
edolstra committed May 25, 2009
1 parent c96f0d7 commit 60b3f95
Show file tree
Hide file tree
Showing 10 changed files with 188 additions and 250 deletions.
5 changes: 3 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ in
grubMenuBuilder
kernel
modulesTree
nix
system
systemPath
config
Expand All @@ -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

Expand Down
150 changes: 150 additions & 0 deletions modules/config/system-path.nix
Original file line number Diff line number Diff line change
@@ -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

This comment has been minimized.

Copy link
@obadz

obadz Aug 3, 2016

Contributor

@edolstra, any idea why rsync is in systemPacakges

cc @kmicu

This comment has been minimized.

Copy link
@edolstra

edolstra Aug 3, 2016

Author Member

No idea. Should be fine to remove it.

This comment has been minimized.

Copy link
@vcunat

vcunat Aug 6, 2016

Member

It was there before this commit, likely since ages ago.

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];
}
6 changes: 1 addition & 5 deletions modules/services/audio/pulseaudio.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ mkIf config.services.pulseaudio.enable {
];

environment = {

extraPackages =
pkgs.lib.optional
(!config.environment.cleanStart)
pkgs.pulseaudio;
extraPackages = [pkgs.pulseaudio];
};

users = {
Expand Down
16 changes: 15 additions & 1 deletion modules/services/misc/nix-daemon.nix
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
6 changes: 1 addition & 5 deletions modules/services/scheduling/cron.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ in
# ? # config.time.timeZone
# ? # config.environment.etc
# ? # config.environment.extraPackages
# ? # config.environment.cleanStart
options
];

Expand All @@ -71,10 +70,7 @@ in
}
];

extraPackages =
pkgs.lib.optional
(!config.environment.cleanStart)
pkgs.cron;
extraPackages = [pkgs.cron];
};

services = {
Expand Down
5 changes: 1 addition & 4 deletions modules/services/scheduling/fcron.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,7 @@ in
}
];

extraPackages = ifEnabled (
pkgs.lib.optional
(!config.environment.cleanStart)
pkgs.fcron);
extraPackages = ifEnabled [pkgs.fcron];
};

services = {
Expand Down
50 changes: 1 addition & 49 deletions system/nixos-environment.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{pkgs, config, ...}:

let
inherit (pkgs.lib) mergeOneOption mkOption;
in
with pkgs.lib;

{
environment = {
Expand All @@ -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.
";
};
};
}
13 changes: 8 additions & 5 deletions system/options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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).
";
};
};
Expand Down Expand Up @@ -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
Expand Down
25 changes: 0 additions & 25 deletions system/system-options.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 60b3f95

Please sign in to comment.