modprobe service: drop kmod wrapper

This commit is contained in:
Nikolay Amiantov 2016-08-14 13:00:52 +03:00
parent 1afd250676
commit b2ebecd9e5
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)); devices = map (nr: "zram${toString nr}") (range 0 (cfg.numDevices - 1));
modprobe = "${config.system.sbin.modprobe}/sbin/modprobe"; modprobe = "${pkgs.kmod}/bin/modprobe";
in in

View File

@ -58,7 +58,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 \"${config.system.sbin.modprobe}/sbin/modprobe \ --replace \"/sbin/modprobe \"${pkgs.kmod}/bin/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 \

View File

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

View File

@ -118,7 +118,7 @@ in
systemd.services.strongswan = { systemd.services.strongswan = {
description = "strongSwan IPSec Service"; description = "strongSwan IPSec Service";
wantedBy = [ "multi-user.target" ]; 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" ]; wants = [ "keys.target" ];
after = [ "network.target" "keys.target" ]; after = [ "network.target" "keys.target" ];
environment = { environment = {

View File

@ -8,41 +8,6 @@ with lib;
options = { 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 { boot.blacklistedKernelModules = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
@ -87,7 +52,7 @@ with lib;
''; '';
environment.etc."modprobe.d/debian.conf".source = pkgs.kmod-debian-aliases; 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 = system.activationScripts.modprobe =
'' ''
@ -95,7 +60,7 @@ with lib;
# in the right location in the Nix store for kernel modules). # in the right location in the Nix store for kernel modules).
# 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 ${pkgs.kmod}/bin/modprobe > /proc/sys/kernel/modprobe
''; '';
environment.sessionVariables.MODULE_DIR = "/run/current-system/kernel-modules/lib/modules"; environment.sessionVariables.MODULE_DIR = "/run/current-system/kernel-modules/lib/modules";

View File

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

View File

@ -95,7 +95,7 @@ in
LimitNPROC = 1048576; LimitNPROC = 1048576;
} // proxy_env; } // 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"; environment.MODULE_DIR = "/run/current-system/kernel-modules/lib/modules";
postStart = if cfg.socketActivation then "" else cfg.postStart; postStart = if cfg.socketActivation then "" else cfg.postStart;