modprobe service: drop kmod wrapper

This commit is contained in:
Nikolay Amiantov 2016-08-14 13:00:52 +03:00
parent ff22705793
commit 5ff6e98486
7 changed files with 8 additions and 43 deletions

View File

@ -8,7 +8,7 @@ let
devices = map (nr: "zram${toString nr}") (range 0 (cfg.numDevices - 1));
modprobe = "${config.system.sbin.modprobe}/sbin/modprobe";
modprobe = "${pkgs.kmod}/bin/modprobe";
in

View File

@ -58,7 +58,7 @@ let
# Fix some paths in the standard udev rules. Hacky.
for i in $out/*.rules; do
substituteInPlace $i \
--replace \"/sbin/modprobe \"${config.system.sbin.modprobe}/sbin/modprobe \
--replace \"/sbin/modprobe \"${pkgs.kmod}/bin/modprobe \
--replace \"/sbin/mdadm \"${pkgs.mdadm}/sbin/mdadm \
--replace \"/sbin/blkid \"${pkgs.utillinux}/sbin/blkid \
--replace \"/bin/mount \"${pkgs.utillinux}/bin/mount \

View File

@ -5,7 +5,7 @@ with lib;
let
cfg = config.networking.fan;
modprobe = "${config.system.sbin.modprobe}/sbin/modprobe";
modprobe = "${pkgs.kmod}/bin/modprobe";
in

View File

@ -118,7 +118,7 @@ in
systemd.services.strongswan = {
description = "strongSwan IPSec Service";
wantedBy = [ "multi-user.target" ];
path = with pkgs; [ config.system.sbin.modprobe iproute iptables utillinux ]; # XXX Linux
path = with pkgs; [ kmod iproute iptables utillinux ]; # XXX Linux
wants = [ "keys.target" ];
after = [ "network.target" "keys.target" ];
environment = {

View File

@ -8,41 +8,6 @@ with lib;
options = {
system.sbin.modprobe = mkOption {
internal = true;
default = pkgs.stdenv.mkDerivation {
name = "modprobe";
buildCommand = ''
mkdir -p $out/bin
for i in ${pkgs.kmod}/sbin/*; do
name=$(basename $i)
echo "$text" > $out/bin/$name
echo 'exec '$i' "$@"' >> $out/bin/$name
chmod +x $out/bin/$name
done
ln -s bin $out/sbin
'';
text =
''
#! ${pkgs.stdenv.shell}
export MODULE_DIR=/run/current-system/kernel-modules/lib/modules
# Fall back to the kernel modules used at boot time if the
# modules in the current configuration don't match the
# running kernel.
if [ ! -d "$MODULE_DIR/$(${pkgs.coreutils}/bin/uname -r)" ]; then
MODULE_DIR=/run/booted-system/kernel-modules/lib/modules/
fi
'';
meta.priority = 4;
};
description = ''
Wrapper around modprobe that sets the path to the modules
tree.
'';
};
boot.blacklistedKernelModules = mkOption {
type = types.listOf types.str;
default = [];
@ -87,7 +52,7 @@ with lib;
'';
environment.etc."modprobe.d/debian.conf".source = pkgs.kmod-debian-aliases;
environment.systemPackages = [ config.system.sbin.modprobe pkgs.kmod ];
environment.systemPackages = [ pkgs.kmod ];
system.activationScripts.modprobe =
''
@ -95,7 +60,7 @@ with lib;
# in the right location in the Nix store for kernel modules).
# We need this when the kernel (or some module) auto-loads a
# module.
echo ${config.system.sbin.modprobe}/sbin/modprobe > /proc/sys/kernel/modprobe
echo ${pkgs.kmod}/bin/modprobe > /proc/sys/kernel/modprobe
'';
environment.sessionVariables.MODULE_DIR = "/run/current-system/kernel-modules/lib/modules";

View File

@ -38,7 +38,7 @@ in
description = "CPU Frequency Governor Setup";
after = [ "systemd-modules-load.service" ];
wantedBy = [ "multi-user.target" ];
path = [ cpupower config.system.sbin.modprobe ];
path = [ cpupower pkgs.kmod ];
unitConfig.ConditionVirtualization = false;
serviceConfig = {
Type = "oneshot";

View File

@ -95,7 +95,7 @@ in
LimitNPROC = 1048576;
} // proxy_env;
path = [ config.system.sbin.modprobe ] ++ (optional (cfg.storageDriver == "zfs") pkgs.zfs);
path = [ pkgs.kmod ] ++ (optional (cfg.storageDriver == "zfs") pkgs.zfs);
environment.MODULE_DIR = "/run/current-system/kernel-modules/lib/modules";
postStart = if cfg.socketActivation then "" else cfg.postStart;