diff --git a/modules/config/system-path.nix b/modules/config/system-path.nix index 2a25cd411a1..d5939db95ac 100644 --- a/modules/config/system-path.nix +++ b/modules/config/system-path.nix @@ -16,8 +16,7 @@ let ''; requiredPackages = - [ config.system.sbin.modprobe # must take precedence over module_init_tools - config.environment.nix + [ config.environment.nix pkgs.acl pkgs.attr pkgs.bashInteractive # bash with ncurses support @@ -38,7 +37,6 @@ let pkgs.less pkgs.libcap pkgs.man - pkgs.module_init_tools pkgs.nano pkgs.ncurses pkgs.netcat diff --git a/modules/system/boot/modprobe.nix b/modules/system/boot/modprobe.nix index f210ecec26d..1b34e78ab78 100644 --- a/modules/system/boot/modprobe.nix +++ b/modules/system/boot/modprobe.nix @@ -9,7 +9,6 @@ with pkgs.lib; options = { system.sbin.modprobe = mkOption { - # should be moved in module-init-tools internal = true; default = pkgs.writeTextFile { name = "modprobe"; @@ -18,8 +17,8 @@ with pkgs.lib; text = '' #! ${pkgs.stdenv.shell} - export MODULE_DIR=${config.system.modulesTree}/lib/modules/ - + export MODULE_DIR=/var/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. @@ -27,7 +26,7 @@ with pkgs.lib; MODULE_DIR=/var/run/booted-system/kernel-modules/lib/modules/ fi - exec ${pkgs.module_init_tools}/sbin/modprobe "$@" + exec ${pkgs.kmod}/sbin/modprobe "$@" ''; }; description = '' @@ -78,6 +77,8 @@ with pkgs.lib; target = "modprobe.d/nixos.conf"; }; + environment.systemPackages = [ config.system.sbin.modprobe pkgs.kmod ]; + boot.blacklistedKernelModules = [ # This module is for debugging and generates gigantic amounts # of log output, so it should never be loaded automatically. @@ -104,7 +105,7 @@ with pkgs.lib; environment.shellInit = '' - export MODULE_DIR=${config.system.modulesTree}/lib/modules/ + export MODULE_DIR=/var/run/current-system/kernel-modules/lib/modules ''; }; diff --git a/modules/system/boot/stage-2-init.sh b/modules/system/boot/stage-2-init.sh index 42dd21b6204..384c9e301cb 100644 --- a/modules/system/boot/stage-2-init.sh +++ b/modules/system/boot/stage-2-init.sh @@ -188,12 +188,8 @@ if [ -n "$debug2" ]; then fi -# FIXME: auto-loading of kernel modules in systemd doesn't work yet -# because it uses libkmod. -"$(cat /proc/sys/kernel/modprobe)" autofs4 -"$(cat /proc/sys/kernel/modprobe)" ipv6 - - # Start systemd. echo "starting systemd..." -PATH=/var/run/current-system/systemd/lib/systemd exec systemd --log-target journal --log-level debug --crash-shell +PATH=/var/run/current-system/systemd/lib/systemd \ + MODULE_DIR=/var/run/current-system/kernel-modules/lib/modules \ + exec systemd --log-target journal --log-level debug --crash-shell