tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
modprobe service: drop kmod wrapper
Nikolay Amiantov
9 years ago
5ff6e984
ff227057
+8
-43
7 changed files
expand all
collapse all
unified
split
nixos
modules
config
zram.nix
services
hardware
udev.nix
networking
fan.nix
strongswan.nix
system
boot
modprobe.nix
tasks
cpu-freq.nix
virtualisation
docker.nix
+1
-1
nixos/modules/config/zram.nix
···
8
8
9
9
devices = map (nr: "zram${toString nr}") (range 0 (cfg.numDevices - 1));
10
10
11
11
-
modprobe = "${config.system.sbin.modprobe}/sbin/modprobe";
11
11
+
modprobe = "${pkgs.kmod}/bin/modprobe";
12
12
13
13
in
14
14
+1
-1
nixos/modules/services/hardware/udev.nix
···
58
58
# Fix some paths in the standard udev rules. Hacky.
59
59
for i in $out/*.rules; do
60
60
substituteInPlace $i \
61
61
-
--replace \"/sbin/modprobe \"${config.system.sbin.modprobe}/sbin/modprobe \
61
61
+
--replace \"/sbin/modprobe \"${pkgs.kmod}/bin/modprobe \
62
62
--replace \"/sbin/mdadm \"${pkgs.mdadm}/sbin/mdadm \
63
63
--replace \"/sbin/blkid \"${pkgs.utillinux}/sbin/blkid \
64
64
--replace \"/bin/mount \"${pkgs.utillinux}/bin/mount \
+1
-1
nixos/modules/services/networking/fan.nix
···
5
5
let
6
6
7
7
cfg = config.networking.fan;
8
8
-
modprobe = "${config.system.sbin.modprobe}/sbin/modprobe";
8
8
+
modprobe = "${pkgs.kmod}/bin/modprobe";
9
9
10
10
in
11
11
+1
-1
nixos/modules/services/networking/strongswan.nix
···
118
118
systemd.services.strongswan = {
119
119
description = "strongSwan IPSec Service";
120
120
wantedBy = [ "multi-user.target" ];
121
121
-
path = with pkgs; [ config.system.sbin.modprobe iproute iptables utillinux ]; # XXX Linux
121
121
+
path = with pkgs; [ kmod iproute iptables utillinux ]; # XXX Linux
122
122
wants = [ "keys.target" ];
123
123
after = [ "network.target" "keys.target" ];
124
124
environment = {
+2
-37
nixos/modules/system/boot/modprobe.nix
···
8
8
9
9
options = {
10
10
11
11
-
system.sbin.modprobe = mkOption {
12
12
-
internal = true;
13
13
-
default = pkgs.stdenv.mkDerivation {
14
14
-
name = "modprobe";
15
15
-
buildCommand = ''
16
16
-
mkdir -p $out/bin
17
17
-
for i in ${pkgs.kmod}/sbin/*; do
18
18
-
name=$(basename $i)
19
19
-
echo "$text" > $out/bin/$name
20
20
-
echo 'exec '$i' "$@"' >> $out/bin/$name
21
21
-
chmod +x $out/bin/$name
22
22
-
done
23
23
-
ln -s bin $out/sbin
24
24
-
'';
25
25
-
text =
26
26
-
''
27
27
-
#! ${pkgs.stdenv.shell}
28
28
-
export MODULE_DIR=/run/current-system/kernel-modules/lib/modules
29
29
-
30
30
-
# Fall back to the kernel modules used at boot time if the
31
31
-
# modules in the current configuration don't match the
32
32
-
# running kernel.
33
33
-
if [ ! -d "$MODULE_DIR/$(${pkgs.coreutils}/bin/uname -r)" ]; then
34
34
-
MODULE_DIR=/run/booted-system/kernel-modules/lib/modules/
35
35
-
fi
36
36
-
37
37
-
'';
38
38
-
meta.priority = 4;
39
39
-
};
40
40
-
description = ''
41
41
-
Wrapper around modprobe that sets the path to the modules
42
42
-
tree.
43
43
-
'';
44
44
-
};
45
45
-
46
11
boot.blacklistedKernelModules = mkOption {
47
12
type = types.listOf types.str;
48
13
default = [];
···
87
52
'';
88
53
environment.etc."modprobe.d/debian.conf".source = pkgs.kmod-debian-aliases;
89
54
90
90
-
environment.systemPackages = [ config.system.sbin.modprobe pkgs.kmod ];
55
55
+
environment.systemPackages = [ pkgs.kmod ];
91
56
92
57
system.activationScripts.modprobe =
93
58
''
···
95
60
# in the right location in the Nix store for kernel modules).
96
61
# We need this when the kernel (or some module) auto-loads a
97
62
# module.
98
98
-
echo ${config.system.sbin.modprobe}/sbin/modprobe > /proc/sys/kernel/modprobe
63
63
+
echo ${pkgs.kmod}/bin/modprobe > /proc/sys/kernel/modprobe
99
64
'';
100
65
101
66
environment.sessionVariables.MODULE_DIR = "/run/current-system/kernel-modules/lib/modules";
+1
-1
nixos/modules/tasks/cpu-freq.nix
···
38
38
description = "CPU Frequency Governor Setup";
39
39
after = [ "systemd-modules-load.service" ];
40
40
wantedBy = [ "multi-user.target" ];
41
41
-
path = [ cpupower config.system.sbin.modprobe ];
41
41
+
path = [ cpupower pkgs.kmod ];
42
42
unitConfig.ConditionVirtualization = false;
43
43
serviceConfig = {
44
44
Type = "oneshot";
+1
-1
nixos/modules/virtualisation/docker.nix
···
95
95
LimitNPROC = 1048576;
96
96
} // proxy_env;
97
97
98
98
-
path = [ config.system.sbin.modprobe ] ++ (optional (cfg.storageDriver == "zfs") pkgs.zfs);
98
98
+
path = [ pkgs.kmod ] ++ (optional (cfg.storageDriver == "zfs") pkgs.zfs);
99
99
environment.MODULE_DIR = "/run/current-system/kernel-modules/lib/modules";
100
100
101
101
postStart = if cfg.socketActivation then "" else cfg.postStart;