From b2ebecd9e50471ec967ab9cdb2aba793d75cb747 Mon Sep 17 00:00:00 2001 From: Nikolay Amiantov Date: Sun, 14 Aug 2016 13:00:52 +0300 Subject: modprobe service: drop kmod wrapper --- nixos/modules/config/zram.nix | 2 +- nixos/modules/services/hardware/udev.nix | 2 +- nixos/modules/services/networking/fan.nix | 2 +- nixos/modules/services/networking/strongswan.nix | 2 +- nixos/modules/system/boot/modprobe.nix | 39 ++---------------------- nixos/modules/tasks/cpu-freq.nix | 2 +- nixos/modules/virtualisation/docker.nix | 2 +- 7 files changed, 8 insertions(+), 43 deletions(-) diff --git a/nixos/modules/config/zram.nix b/nixos/modules/config/zram.nix index 019932b04e8d..ad41ad4f3d7c 100644 --- a/nixos/modules/config/zram.nix +++ b/nixos/modules/config/zram.nix @@ -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 diff --git a/nixos/modules/services/hardware/udev.nix b/nixos/modules/services/hardware/udev.nix index e7741083d1ae..fb44790ab1f1 100644 --- a/nixos/modules/services/hardware/udev.nix +++ b/nixos/modules/services/hardware/udev.nix @@ -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 \ diff --git a/nixos/modules/services/networking/fan.nix b/nixos/modules/services/networking/fan.nix index 3170567e5b4a..7f4e36478325 100644 --- a/nixos/modules/services/networking/fan.nix +++ b/nixos/modules/services/networking/fan.nix @@ -5,7 +5,7 @@ with lib; let cfg = config.networking.fan; - modprobe = "${config.system.sbin.modprobe}/sbin/modprobe"; + modprobe = "${pkgs.kmod}/bin/modprobe"; in diff --git a/nixos/modules/services/networking/strongswan.nix b/nixos/modules/services/networking/strongswan.nix index d6960a5df471..8778b0364f9a 100644 --- a/nixos/modules/services/networking/strongswan.nix +++ b/nixos/modules/services/networking/strongswan.nix @@ -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 = { diff --git a/nixos/modules/system/boot/modprobe.nix b/nixos/modules/system/boot/modprobe.nix index 9bb10eac9880..91f440535a48 100644 --- a/nixos/modules/system/boot/modprobe.nix +++ b/nixos/modules/system/boot/modprobe.nix @@ -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"; diff --git a/nixos/modules/tasks/cpu-freq.nix b/nixos/modules/tasks/cpu-freq.nix index 1f4d1db33cef..2fe7f4f8197a 100644 --- a/nixos/modules/tasks/cpu-freq.nix +++ b/nixos/modules/tasks/cpu-freq.nix @@ -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"; diff --git a/nixos/modules/virtualisation/docker.nix b/nixos/modules/virtualisation/docker.nix index c99fc78d49e7..97b2927cf1bd 100644 --- a/nixos/modules/virtualisation/docker.nix +++ b/nixos/modules/virtualisation/docker.nix @@ -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; -- cgit 1.4.1