mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-01 23:22:37 +00:00
* 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. svn path=/nixos/trunk/; revision=33208
This commit is contained in:
parent
646d67465c
commit
573877c1ac
@ -88,7 +88,7 @@ in
|
|||||||
|
|
||||||
boot.kernelModules =
|
boot.kernelModules =
|
||||||
[ "acpi_cpufreq" "cpufreq_performance" "cpufreq_powersave" "cpufreq_ondemand"
|
[ "acpi_cpufreq" "cpufreq_performance" "cpufreq_powersave" "cpufreq_ondemand"
|
||||||
"p4_clockmod" "cpufreq_conservative"
|
"cpufreq_conservative"
|
||||||
];
|
];
|
||||||
|
|
||||||
powerManagement.cpuFreqGovernor = mkDefault "ondemand";
|
powerManagement.cpuFreqGovernor = mkDefault "ondemand";
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
{pkgs, config, ...}:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
with pkgs.lib;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -6,11 +8,11 @@
|
|||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
hardware.cpu.intel.updateMicrocode = pkgs.lib.mkOption {
|
hardware.cpu.intel.updateMicrocode = mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
type = pkgs.lib.types.bool;
|
type = types.bool;
|
||||||
description = ''
|
description = ''
|
||||||
Update the CPU microcode for intel processors.
|
Update the CPU microcode for Intel processors.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -19,16 +21,9 @@
|
|||||||
|
|
||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = pkgs.lib.mkIf config.hardware.cpu.intel.updateMicrocode {
|
config = mkIf config.hardware.cpu.intel.updateMicrocode {
|
||||||
hardware.firmware = [pkgs.microcodeIntel];
|
hardware.firmware = [ pkgs.microcodeIntel ];
|
||||||
jobs.microcode = {
|
boot.kernelModules = [ "microcode" ];
|
||||||
name = "microcode";
|
|
||||||
description = "load microcode";
|
|
||||||
startOn = "started udev";
|
|
||||||
exec = "modprobe microcode";
|
|
||||||
path = [config.system.sbin.modprobe];
|
|
||||||
task = true;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,8 @@ in
|
|||||||
|
|
||||||
environment.systemPackages = [ alsaUtils ];
|
environment.systemPackages = [ alsaUtils ];
|
||||||
|
|
||||||
|
boot.kernelModules = optional config.sound.enableOSSEmulation "snd_pcm_oss";
|
||||||
|
|
||||||
jobs.alsa =
|
jobs.alsa =
|
||||||
{ startOn = "stopped udevtrigger";
|
{ startOn = "stopped udevtrigger";
|
||||||
|
|
||||||
@ -52,15 +54,6 @@ in
|
|||||||
''
|
''
|
||||||
mkdir -m 0755 -p $(dirname ${soundState})
|
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.
|
# Restore the sound state.
|
||||||
${alsaUtils}/sbin/alsactl -f ${soundState} restore || true
|
${alsaUtils}/sbin/alsactl -f ${soundState} restore || true
|
||||||
'';
|
'';
|
||||||
|
@ -14,8 +14,6 @@ let
|
|||||||
destination = "/etc/udev/rules.d/10-local.rules";
|
destination = "/etc/udev/rules.d/10-local.rules";
|
||||||
};
|
};
|
||||||
|
|
||||||
modprobe = config.system.sbin.modprobe;
|
|
||||||
|
|
||||||
nixosRules = ''
|
nixosRules = ''
|
||||||
|
|
||||||
# Miscellaneous devices.
|
# Miscellaneous devices.
|
||||||
@ -54,7 +52,7 @@ let
|
|||||||
# Fix some paths in the standard udev rules. Hacky.
|
# Fix some paths in the standard udev rules. Hacky.
|
||||||
for i in $out/*.rules; do
|
for i in $out/*.rules; do
|
||||||
substituteInPlace $i \
|
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/mdadm \"${pkgs.mdadm}/sbin/mdadm \
|
||||||
--replace \"/sbin/blkid \"${pkgs.utillinux}/sbin/blkid \
|
--replace \"/sbin/blkid \"${pkgs.utillinux}/sbin/blkid \
|
||||||
--replace \"/bin/mount \"${pkgs.utillinux}/bin/mount
|
--replace \"/bin/mount \"${pkgs.utillinux}/bin/mount
|
||||||
@ -232,13 +230,6 @@ in
|
|||||||
mkdir -p /var/lib/udev/rules.d
|
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
|
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?
|
mkdir -p /dev/.udev # !!! bug in udev?
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -50,11 +50,6 @@ in
|
|||||||
";
|
";
|
||||||
};
|
};
|
||||||
|
|
||||||
kernelModules = mkOption {
|
|
||||||
default = ["fuse"];
|
|
||||||
description="kernel modules to load";
|
|
||||||
};
|
|
||||||
|
|
||||||
timeout = mkOption {
|
timeout = mkOption {
|
||||||
default = 600;
|
default = 600;
|
||||||
description = "Set the global minimum timeout, in seconds, until directories are unmounted";
|
description = "Set the global minimum timeout, in seconds, until directories are unmounted";
|
||||||
@ -81,19 +76,15 @@ in
|
|||||||
source = pkgs.writeText "auto.master" cfg.autoMaster;
|
source = pkgs.writeText "auto.master" cfg.autoMaster;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
boot.kernelModules = [ "autofs4" ];
|
||||||
|
|
||||||
jobs.autofs =
|
jobs.autofs =
|
||||||
{ description = "Filesystem automounter";
|
{ description = "Filesystem automounter";
|
||||||
|
|
||||||
startOn = "started network-interfaces";
|
startOn = "started network-interfaces";
|
||||||
stopOn = "stopping network-interfaces";
|
stopOn = "stopping network-interfaces";
|
||||||
|
|
||||||
environment =
|
path = [ pkgs.nfsUtils pkgs.sshfsFuse ];
|
||||||
{ 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);
|
|
||||||
|
|
||||||
preStop =
|
preStop =
|
||||||
''
|
''
|
||||||
|
@ -10,8 +10,6 @@ let
|
|||||||
|
|
||||||
ddclientUser = "ddclient";
|
ddclientUser = "ddclient";
|
||||||
|
|
||||||
modprobe = config.system.sbin.modprobe;
|
|
||||||
|
|
||||||
ddclientFlags = "-foreground -file ${ddclientCfg}";
|
ddclientFlags = "-foreground -file ${ddclientCfg}";
|
||||||
|
|
||||||
ddclientCfg = pkgs.writeText "ddclient.conf" ''
|
ddclientCfg = pkgs.writeText "ddclient.conf" ''
|
||||||
@ -89,8 +87,7 @@ in
|
|||||||
|
|
||||||
web = mkOption {
|
web = mkOption {
|
||||||
default = "web, web=checkip.dyndns.com/, web-skip='IP Address'" ;
|
default = "web, web=checkip.dyndns.com/, web-skip='IP Address'" ;
|
||||||
description = ''
|
description = "";
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -101,6 +98,7 @@ in
|
|||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf config.services.ddclient.enable {
|
config = mkIf config.services.ddclient.enable {
|
||||||
|
|
||||||
environment.systemPackages = [ ddclient ];
|
environment.systemPackages = [ ddclient ];
|
||||||
|
|
||||||
users.extraUsers = singleton
|
users.extraUsers = singleton
|
||||||
@ -119,9 +117,6 @@ in
|
|||||||
''
|
''
|
||||||
mkdir -m 0755 -p ${stateDir}
|
mkdir -m 0755 -p ${stateDir}
|
||||||
chown ${ddclientUser} ${stateDir}
|
chown ${ddclientUser} ${stateDir}
|
||||||
|
|
||||||
# Needed to run ddclient as an unprivileged user.
|
|
||||||
${modprobe}/sbin/modprobe capability || true
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
exec = "${ddclient}/bin/ddclient ${ddclientFlags}";
|
exec = "${ddclient}/bin/ddclient ${ddclientFlags}";
|
||||||
|
@ -44,18 +44,15 @@ in
|
|||||||
|
|
||||||
config = mkIf config.networking.useDHCP {
|
config = mkIf config.networking.useDHCP {
|
||||||
|
|
||||||
|
# dhclient barfs if /proc/net/if_inet6 doesn't exist.
|
||||||
|
boot.kernelModules = [ "ipv6" ];
|
||||||
|
|
||||||
jobs.dhclient =
|
jobs.dhclient =
|
||||||
{ startOn = "started network-interfaces";
|
{ startOn = "started network-interfaces";
|
||||||
stopOn = "stopping network-interfaces";
|
stopOn = "stopping network-interfaces";
|
||||||
|
|
||||||
path = [ dhcp ];
|
path = [ dhcp ];
|
||||||
|
|
||||||
preStart =
|
|
||||||
''
|
|
||||||
# dhclient barfs if /proc/net/if_inet6 doesn't exist.
|
|
||||||
${config.system.sbin.modprobe}/sbin/modprobe ipv6 || true
|
|
||||||
'';
|
|
||||||
|
|
||||||
script =
|
script =
|
||||||
''
|
''
|
||||||
# Determine the interface on which to start dhclient.
|
# Determine the interface on which to start dhclient.
|
||||||
|
@ -10,16 +10,12 @@ let
|
|||||||
|
|
||||||
ntpUser = "ntp";
|
ntpUser = "ntp";
|
||||||
|
|
||||||
servers = config.services.ntp.servers;
|
|
||||||
|
|
||||||
modprobe = config.system.sbin.modprobe;
|
|
||||||
|
|
||||||
configFile = pkgs.writeText "ntp.conf" ''
|
configFile = pkgs.writeText "ntp.conf" ''
|
||||||
# Keep the drift file in ${stateDir}/ntp.drift. However, since we
|
# Keep the drift file in ${stateDir}/ntp.drift. However, since we
|
||||||
# chroot to ${stateDir}, we have to specify it as /ntp.drift.
|
# chroot to ${stateDir}, we have to specify it as /ntp.drift.
|
||||||
driftfile /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}";
|
ntpFlags = "-c ${configFile} -u ${ntpUser}:nogroup -i ${stateDir}";
|
||||||
@ -69,8 +65,6 @@ in
|
|||||||
home = stateDir;
|
home = stateDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.kernelModules = [ "capability" ];
|
|
||||||
|
|
||||||
jobs.ntpd =
|
jobs.ntpd =
|
||||||
{ description = "NTP daemon";
|
{ description = "NTP daemon";
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ in
|
|||||||
jobs.portmap =
|
jobs.portmap =
|
||||||
{ description = "ONC RPC portmap";
|
{ description = "ONC RPC portmap";
|
||||||
|
|
||||||
startOn = "started network-interfaces";
|
startOn = "startup";
|
||||||
stopOn = "never";
|
stopOn = "never";
|
||||||
|
|
||||||
daemonType = "fork"; # needed during shutdown
|
daemonType = "fork"; # needed during shutdown
|
||||||
|
@ -10,8 +10,6 @@ let
|
|||||||
|
|
||||||
privoxyUser = "privoxy";
|
privoxyUser = "privoxy";
|
||||||
|
|
||||||
modprobe = config.system.sbin.modprobe;
|
|
||||||
|
|
||||||
privoxyFlags = "--no-daemon --user ${privoxyUser} ${privoxyCfg}";
|
privoxyFlags = "--no-daemon --user ${privoxyUser} ${privoxyCfg}";
|
||||||
|
|
||||||
privoxyCfg = pkgs.writeText "privoxy.conf" ''
|
privoxyCfg = pkgs.writeText "privoxy.conf" ''
|
||||||
@ -68,12 +66,13 @@ in
|
|||||||
###### implementation
|
###### implementation
|
||||||
|
|
||||||
config = mkIf config.services.privoxy.enable {
|
config = mkIf config.services.privoxy.enable {
|
||||||
|
|
||||||
environment.systemPackages = [ privoxy ];
|
environment.systemPackages = [ privoxy ];
|
||||||
|
|
||||||
users.extraUsers = singleton
|
users.extraUsers = singleton
|
||||||
{ name = privoxyUser;
|
{ name = privoxyUser;
|
||||||
uid = config.ids.uids.privoxy;
|
uid = config.ids.uids.privoxy;
|
||||||
description = "privoxy daemon user";
|
description = "Privoxy daemon user";
|
||||||
home = stateDir;
|
home = stateDir;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -86,9 +85,6 @@ in
|
|||||||
''
|
''
|
||||||
mkdir -m 0755 -p ${stateDir}
|
mkdir -m 0755 -p ${stateDir}
|
||||||
chown ${privoxyUser} ${stateDir}
|
chown ${privoxyUser} ${stateDir}
|
||||||
|
|
||||||
# Needed to run privoxy as an unprivileged user.
|
|
||||||
${modprobe}/sbin/modprobe capability || true
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
exec = "${privoxy}/sbin/privoxy ${privoxyFlags}";
|
exec = "${privoxy}/sbin/privoxy ${privoxyFlags}";
|
||||||
|
@ -8,8 +8,6 @@ let
|
|||||||
|
|
||||||
logDir = "/var/log/cups";
|
logDir = "/var/log/cups";
|
||||||
|
|
||||||
modprobe = config.system.sbin.modprobe;
|
|
||||||
|
|
||||||
cfg = config.services.printing;
|
cfg = config.services.printing;
|
||||||
|
|
||||||
additionalBackends = pkgs.stdenv.mkDerivation {
|
additionalBackends = pkgs.stdenv.mkDerivation {
|
||||||
|
@ -9,14 +9,13 @@ let
|
|||||||
stateDir = "/var/lib/tor";
|
stateDir = "/var/lib/tor";
|
||||||
privoxyDir = stateDir+"/privoxy";
|
privoxyDir = stateDir+"/privoxy";
|
||||||
|
|
||||||
modprobe = config.system.sbin.modprobe;
|
|
||||||
|
|
||||||
cfg = config.services.tor;
|
cfg = config.services.tor;
|
||||||
|
|
||||||
torUser = "tor";
|
torUser = "tor";
|
||||||
|
|
||||||
opt = name: value: if value != "" then "${name} ${value}" else "";
|
opt = name: value: if value != "" then "${name} ${value}" else "";
|
||||||
optint = name: value: if value != 0 then "${name} ${toString value}" else "";
|
optint = name: value: if value != 0 then "${name} ${toString value}" else "";
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -251,9 +250,6 @@ in
|
|||||||
preStart = ''
|
preStart = ''
|
||||||
mkdir -m 0755 -p ${privoxyDir}
|
mkdir -m 0755 -p ${privoxyDir}
|
||||||
chown ${torUser} ${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}";
|
exec = "${privoxy}/sbin/privoxy --no-daemon --user ${torUser} ${pkgs.writeText "torPrivoxy.conf" cfg.client.privoxy.config}";
|
||||||
}; };
|
}; };
|
||||||
|
@ -96,6 +96,10 @@ in
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
# The daemon requires the userspace<->kernelspace netlink
|
||||||
|
# connector.
|
||||||
|
boot.kernelModules = [ "cn" ];
|
||||||
|
|
||||||
jobs.cgroups =
|
jobs.cgroups =
|
||||||
{ startOn = "startup";
|
{ startOn = "startup";
|
||||||
|
|
||||||
@ -105,10 +109,6 @@ in
|
|||||||
|
|
||||||
preStart =
|
preStart =
|
||||||
''
|
''
|
||||||
# The daemon requires the userspace<->kernelspace netlink
|
|
||||||
# connector.
|
|
||||||
${config.system.sbin.modprobe}/sbin/modprobe cn || true
|
|
||||||
|
|
||||||
cgclear || true
|
cgclear || true
|
||||||
|
|
||||||
# Mount the cgroup hierarchies. Note: we refer to the
|
# Mount the cgroup hierarchies. Note: we refer to the
|
||||||
|
@ -10,10 +10,6 @@ let
|
|||||||
|
|
||||||
uptimedUser = "uptimed";
|
uptimedUser = "uptimed";
|
||||||
|
|
||||||
modprobe = config.system.sbin.modprobe;
|
|
||||||
|
|
||||||
uptimedFlags = "";
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -59,15 +55,12 @@ in
|
|||||||
mkdir -m 0755 -p ${stateDir}
|
mkdir -m 0755 -p ${stateDir}
|
||||||
chown ${uptimedUser} ${stateDir}
|
chown ${uptimedUser} ${stateDir}
|
||||||
|
|
||||||
# Needed to run uptimed as an unprivileged user.
|
|
||||||
${modprobe}/sbin/modprobe capability || true
|
|
||||||
|
|
||||||
if ! test -f ${stateDir}/bootid ; then
|
if ! test -f ${stateDir}/bootid ; then
|
||||||
${uptimed}/sbin/uptimed -b
|
${uptimed}/sbin/uptimed -b
|
||||||
fi
|
fi
|
||||||
'';
|
'';
|
||||||
|
|
||||||
exec = "${uptimed}/sbin/uptimed ${uptimedFlags}";
|
exec = "${uptimed}/sbin/uptimed";
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -100,6 +100,11 @@ with pkgs.lib;
|
|||||||
# We need this when the kernel (or some module) auto-loads a
|
# We need this when the kernel (or some module) auto-loads a
|
||||||
# module.
|
# module.
|
||||||
echo ${config.system.sbin.modprobe}/sbin/modprobe > /proc/sys/kernel/modprobe
|
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
|
||||||
'';
|
'';
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user