Author: eelco
Date: Sat Mar 17 17:26:17 2012
New Revision: 33208
URL: https://nixos.org/websvn/nix/?rev=33208&sc=1
Log:
* Use boot.kernelModules everywhere instead of explicit calls to
modprobe.
* Move the implementation of boot.kernelModules from the udev job to
the activation script. This prevents races with the udev job.
* Drop references to the "capability" kernel module, which no longer
exists.
Modified:
nixos/trunk/modules/config/power-management.nix
nixos/trunk/modules/hardware/cpu/intel-microcode.nix
nixos/trunk/modules/services/audio/alsa.nix
nixos/trunk/modules/services/hardware/udev.nix
nixos/trunk/modules/services/misc/autofs.nix
nixos/trunk/modules/services/networking/ddclient.nix
nixos/trunk/modules/services/networking/dhclient.nix
nixos/trunk/modules/services/networking/ntpd.nix
nixos/trunk/modules/services/networking/portmap.nix
nixos/trunk/modules/services/networking/privoxy.nix
nixos/trunk/modules/services/printing/cupsd.nix
nixos/trunk/modules/services/security/tor.nix
nixos/trunk/modules/services/system/cgroups.nix
nixos/trunk/modules/services/system/uptimed.nix
nixos/trunk/modules/system/boot/modprobe.nix
Modified: nixos/trunk/modules/config/power-management.nix
==============================================================================
--- nixos/trunk/modules/config/power-management.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/config/power-management.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -88,7 +88,7 @@
boot.kernelModules =
[ "acpi_cpufreq" "cpufreq_performance" "cpufreq_powersave"
"cpufreq_ondemand"
- "p4_clockmod" "cpufreq_conservative"
+ "cpufreq_conservative"
];
powerManagement.cpuFreqGovernor = mkDefault "ondemand";
Modified: nixos/trunk/modules/hardware/cpu/intel-microcode.nix
==============================================================================
--- nixos/trunk/modules/hardware/cpu/intel-microcode.nix Sat Mar 17
17:20:39 2012 (r33207)
+++ nixos/trunk/modules/hardware/cpu/intel-microcode.nix Sat Mar 17
17:26:17 2012 (r33208)
@@ -1,4 +1,6 @@
-{pkgs, config, ...}:
+{ config, pkgs, ... }:
+
+with pkgs.lib;
{
@@ -6,11 +8,11 @@
options = {
- hardware.cpu.intel.updateMicrocode = pkgs.lib.mkOption {
+ hardware.cpu.intel.updateMicrocode = mkOption {
default = false;
- type = pkgs.lib.types.bool;
+ type = types.bool;
description = ''
- Update the CPU microcode for intel processors.
+ Update the CPU microcode for Intel processors.
'';
};
@@ -19,16 +21,9 @@
###### implementation
- config = pkgs.lib.mkIf config.hardware.cpu.intel.updateMicrocode {
- hardware.firmware = [pkgs.microcodeIntel];
- jobs.microcode = {
- name = "microcode";
- description = "load microcode";
- startOn = "started udev";
- exec = "modprobe microcode";
- path = [config.system.sbin.modprobe];
- task = true;
- };
+ config = mkIf config.hardware.cpu.intel.updateMicrocode {
+ hardware.firmware = [ pkgs.microcodeIntel ];
+ boot.kernelModules = [ "microcode" ];
};
}
Modified: nixos/trunk/modules/services/audio/alsa.nix
==============================================================================
--- nixos/trunk/modules/services/audio/alsa.nix Sat Mar 17 17:20:39 2012
(r33207)
+++ nixos/trunk/modules/services/audio/alsa.nix Sat Mar 17 17:26:17 2012
(r33208)
@@ -45,6 +45,8 @@
environment.systemPackages = [ alsaUtils ];
+ boot.kernelModules = optional config.sound.enableOSSEmulation
"snd_pcm_oss";
+
jobs.alsa =
{ startOn = "stopped udevtrigger";
@@ -52,15 +54,6 @@
''
mkdir -m 0755 -p $(dirname ${soundState})
- # Load some additional modules.
- ${optionalString config.sound.enableOSSEmulation
- ''
- for mod in snd_pcm_oss; do
- ${config.system.sbin.modprobe}/sbin/modprobe $mod || true
- done
- ''
- }
-
# Restore the sound state.
${alsaUtils}/sbin/alsactl -f ${soundState} restore || true
'';
Modified: nixos/trunk/modules/services/hardware/udev.nix
==============================================================================
--- nixos/trunk/modules/services/hardware/udev.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/services/hardware/udev.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -14,8 +14,6 @@
destination = "/etc/udev/rules.d/10-local.rules";
};
- modprobe = config.system.sbin.modprobe;
-
nixosRules = ''
# Miscellaneous devices.
@@ -54,7 +52,7 @@
# Fix some paths in the standard udev rules. Hacky.
for i in $out/*.rules; do
substituteInPlace $i \
- --replace \"/sbin/modprobe \"${modprobe}/sbin/modprobe \
+ --replace \"/sbin/modprobe
\"${config.system.sbin.modprobe}/sbin/modprobe \
--replace \"/sbin/mdadm \"${pkgs.mdadm}/sbin/mdadm \
--replace \"/sbin/blkid \"${pkgs.utillinux}/sbin/blkid \
--replace \"/bin/mount \"${pkgs.utillinux}/bin/mount
@@ -232,13 +230,6 @@
mkdir -p /var/lib/udev/rules.d
touch /var/lib/udev/rules.d/70-persistent-cd.rules
/var/lib/udev/rules.d/70-persistent-net.rules
- # Do the loading of additional stage 2 kernel modules.
- # Maybe this isn't the best place...
- for i in ${toString config.boot.kernelModules}; do
- echo "Loading kernel module $i..."
- ${modprobe}/sbin/modprobe $i || true
- done
-
mkdir -p /dev/.udev # !!! bug in udev?
'';
Modified: nixos/trunk/modules/services/misc/autofs.nix
==============================================================================
--- nixos/trunk/modules/services/misc/autofs.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/services/misc/autofs.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -50,11 +50,6 @@
";
};
- kernelModules = mkOption {
- default = ["fuse"];
- description="kernel modules to load";
- };
-
timeout = mkOption {
default = 600;
description = "Set the global minimum timeout, in seconds, until
directories are unmounted";
@@ -81,19 +76,15 @@
source = pkgs.writeText "auto.master" cfg.autoMaster;
};
+ boot.kernelModules = [ "autofs4" ];
+
jobs.autofs =
{ description = "Filesystem automounter";
startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
- environment =
- { PATH =
"${pkgs.nfsUtils}/sbin:${config.system.sbin.modprobe}/sbin:${pkgs.sshfsFuse}/sbin:${pkgs.sshfsFuse}/bin:$PATH";
- };
-
- preStart =
- pkgs.lib.concatMapStrings (module : "modprobe ${module} || true\n")
- (["autofs4"] ++ cfg.kernelModules);
+ path = [ pkgs.nfsUtils pkgs.sshfsFuse ];
preStop =
''
Modified: nixos/trunk/modules/services/networking/ddclient.nix
==============================================================================
--- nixos/trunk/modules/services/networking/ddclient.nix Sat Mar 17
17:20:39 2012 (r33207)
+++ nixos/trunk/modules/services/networking/ddclient.nix Sat Mar 17
17:26:17 2012 (r33208)
@@ -10,8 +10,6 @@
ddclientUser = "ddclient";
- modprobe = config.system.sbin.modprobe;
-
ddclientFlags = "-foreground -file ${ddclientCfg}";
ddclientCfg = pkgs.writeText "ddclient.conf" ''
@@ -89,8 +87,7 @@
web = mkOption {
default = "web, web=checkip.dyndns.com/, web-skip='IP Address'" ;
- description = ''
- '';
+ description = "";
};
};
@@ -101,6 +98,7 @@
###### implementation
config = mkIf config.services.ddclient.enable {
+
environment.systemPackages = [ ddclient ];
users.extraUsers = singleton
@@ -119,9 +117,6 @@
''
mkdir -m 0755 -p ${stateDir}
chown ${ddclientUser} ${stateDir}
-
- # Needed to run ddclient as an unprivileged user.
- ${modprobe}/sbin/modprobe capability || true
'';
exec = "${ddclient}/bin/ddclient ${ddclientFlags}";
Modified: nixos/trunk/modules/services/networking/dhclient.nix
==============================================================================
--- nixos/trunk/modules/services/networking/dhclient.nix Sat Mar 17
17:20:39 2012 (r33207)
+++ nixos/trunk/modules/services/networking/dhclient.nix Sat Mar 17
17:26:17 2012 (r33208)
@@ -44,18 +44,15 @@
config = mkIf config.networking.useDHCP {
+ # dhclient barfs if /proc/net/if_inet6 doesn't exist.
+ boot.kernelModules = [ "ipv6" ];
+
jobs.dhclient =
{ startOn = "started network-interfaces";
stopOn = "stopping network-interfaces";
path = [ dhcp ];
- preStart =
- ''
- # dhclient barfs if /proc/net/if_inet6 doesn't exist.
- ${config.system.sbin.modprobe}/sbin/modprobe ipv6 || true
- '';
-
script =
''
# Determine the interface on which to start dhclient.
Modified: nixos/trunk/modules/services/networking/ntpd.nix
==============================================================================
--- nixos/trunk/modules/services/networking/ntpd.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/services/networking/ntpd.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -10,16 +10,12 @@
ntpUser = "ntp";
- servers = config.services.ntp.servers;
-
- modprobe = config.system.sbin.modprobe;
-
configFile = pkgs.writeText "ntp.conf" ''
# Keep the drift file in ${stateDir}/ntp.drift. However, since we
# chroot to ${stateDir}, we have to specify it as /ntp.drift.
driftfile /ntp.drift
- ${toString (map (server: "server " + server + " iburst\n") servers)}
+ ${toString (map (server: "server " + server + " iburst\n")
config.services.ntp.servers)}
'';
ntpFlags = "-c ${configFile} -u ${ntpUser}:nogroup -i ${stateDir}";
@@ -69,8 +65,6 @@
home = stateDir;
};
- boot.kernelModules = [ "capability" ];
-
jobs.ntpd =
{ description = "NTP daemon";
Modified: nixos/trunk/modules/services/networking/portmap.nix
==============================================================================
--- nixos/trunk/modules/services/networking/portmap.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/services/networking/portmap.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -68,7 +68,7 @@
jobs.portmap =
{ description = "ONC RPC portmap";
- startOn = "started network-interfaces";
+ startOn = "startup";
stopOn = "never";
daemonType = "fork"; # needed during shutdown
Modified: nixos/trunk/modules/services/networking/privoxy.nix
==============================================================================
--- nixos/trunk/modules/services/networking/privoxy.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/services/networking/privoxy.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -10,8 +10,6 @@
privoxyUser = "privoxy";
- modprobe = config.system.sbin.modprobe;
-
privoxyFlags = "--no-daemon --user ${privoxyUser} ${privoxyCfg}";
privoxyCfg = pkgs.writeText "privoxy.conf" ''
@@ -68,12 +66,13 @@
###### implementation
config = mkIf config.services.privoxy.enable {
+
environment.systemPackages = [ privoxy ];
users.extraUsers = singleton
{ name = privoxyUser;
uid = config.ids.uids.privoxy;
- description = "privoxy daemon user";
+ description = "Privoxy daemon user";
home = stateDir;
};
@@ -86,9 +85,6 @@
''
mkdir -m 0755 -p ${stateDir}
chown ${privoxyUser} ${stateDir}
-
- # Needed to run privoxy as an unprivileged user.
- ${modprobe}/sbin/modprobe capability || true
'';
exec = "${privoxy}/sbin/privoxy ${privoxyFlags}";
Modified: nixos/trunk/modules/services/printing/cupsd.nix
==============================================================================
--- nixos/trunk/modules/services/printing/cupsd.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/services/printing/cupsd.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -8,8 +8,6 @@
logDir = "/var/log/cups";
- modprobe = config.system.sbin.modprobe;
-
cfg = config.services.printing;
additionalBackends = pkgs.stdenv.mkDerivation {
Modified: nixos/trunk/modules/services/security/tor.nix
==============================================================================
--- nixos/trunk/modules/services/security/tor.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/services/security/tor.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -9,14 +9,13 @@
stateDir = "/var/lib/tor";
privoxyDir = stateDir+"/privoxy";
- modprobe = config.system.sbin.modprobe;
-
cfg = config.services.tor;
torUser = "tor";
opt = name: value: if value != "" then "${name} ${value}" else "";
optint = name: value: if value != 0 then "${name} ${toString value}" else "";
+
in
{
@@ -251,9 +250,6 @@
preStart = ''
mkdir -m 0755 -p ${privoxyDir}
chown ${torUser} ${privoxyDir}
-
- # Needed to run privoxy as an unprivileged user?
- ${modprobe}/sbin/modprobe capability || true
'';
exec = "${privoxy}/sbin/privoxy --no-daemon --user
${torUser} ${pkgs.writeText "torPrivoxy.conf" cfg.client.privoxy.config}";
}; };
Modified: nixos/trunk/modules/services/system/cgroups.nix
==============================================================================
--- nixos/trunk/modules/services/system/cgroups.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/services/system/cgroups.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -96,6 +96,10 @@
}
];
+ # The daemon requires the userspace<->kernelspace netlink
+ # connector.
+ boot.kernelModules = [ "cn" ];
+
jobs.cgroups =
{ startOn = "startup";
@@ -105,10 +109,6 @@
preStart =
''
- # The daemon requires the userspace<->kernelspace netlink
- # connector.
- ${config.system.sbin.modprobe}/sbin/modprobe cn || true
-
cgclear || true
# Mount the cgroup hierarchies. Note: we refer to the
Modified: nixos/trunk/modules/services/system/uptimed.nix
==============================================================================
--- nixos/trunk/modules/services/system/uptimed.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/services/system/uptimed.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -10,10 +10,6 @@
uptimedUser = "uptimed";
- modprobe = config.system.sbin.modprobe;
-
- uptimedFlags = "";
-
in
{
@@ -59,15 +55,12 @@
mkdir -m 0755 -p ${stateDir}
chown ${uptimedUser} ${stateDir}
- # Needed to run uptimed as an unprivileged user.
- ${modprobe}/sbin/modprobe capability || true
-
if ! test -f ${stateDir}/bootid ; then
${uptimed}/sbin/uptimed -b
fi
'';
- exec = "${uptimed}/sbin/uptimed ${uptimedFlags}";
+ exec = "${uptimed}/sbin/uptimed";
};
};
Modified: nixos/trunk/modules/system/boot/modprobe.nix
==============================================================================
--- nixos/trunk/modules/system/boot/modprobe.nix Sat Mar 17 17:20:39
2012 (r33207)
+++ nixos/trunk/modules/system/boot/modprobe.nix Sat Mar 17 17:26:17
2012 (r33208)
@@ -100,6 +100,11 @@
# We need this when the kernel (or some module) auto-loads a
# module.
echo ${config.system.sbin.modprobe}/sbin/modprobe >
/proc/sys/kernel/modprobe
+
+ # Do the loading of additional stage 2 kernel modules.
+ for i in ${toString config.boot.kernelModules}; do
+ ${config.system.sbin.modprobe}/sbin/modprobe $i || true
+ done
'';
};
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits