diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index 3b0e84a730f..6320526a31c 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -134,7 +134,42 @@ let }; }; + + system.modulesTree = mkOption { + internal = true; + default = []; + description = " + Tree of kernel modules. This includes the kernel, plus modules + built outside of the kernel. Combine these into a single tree of + symlinks because modprobe only supports one directory. + "; + merge = pkgs.lib.mergeListOption; + + # Convert the list of path to only one path. + apply = pkgs.aggregateModules; + }; + + system.sbin.modprobe = mkOption { + # should be moved in module-init-tools + internal = true; + default = pkgs.writeTextFile { + name = "modprobe"; + destination = "/sbin/modprobe"; + executable = true; + text = + '' + #! ${pkgs.stdenv.shell} + export MODULE_DIR=${config.system.modulesTree}/lib/modules + exec ${pkgs.module_init_tools}/sbin/modprobe "$@" + ''; + }; + description = '' + Wrapper around modprobe that sets the path to the modules + tree. + ''; + }; }; + in ###### implementation diff --git a/system/modprobe b/system/modprobe deleted file mode 100644 index 293d9bbfd5f..00000000000 --- a/system/modprobe +++ /dev/null @@ -1,3 +0,0 @@ -#! @shell@ -export MODULE_DIR=@modulesTree@/lib/modules -exec @module_init_tools@/sbin/modprobe "$@" diff --git a/system/options.nix b/system/options.nix index 8a686cd9ee1..63ef9bc94a3 100644 --- a/system/options.nix +++ b/system/options.nix @@ -95,37 +95,7 @@ in }; }; - modulesTree = mkOption { - internal = true; - default = []; - description = " - Tree of kernel modules. This includes the kernel, plus modules - built outside of the kernel. Combine these into a single tree of - symlinks because modprobe only supports one directory. - "; - merge = pkgs.lib.mergeListOption; - - # Convert the list of path to only one path. - apply = pkgs.aggregateModules; - }; - sbin = { - modprobe = mkOption { - # should be moved in module-init-tools - internal = true; - default = pkgs.substituteAll { - dir = "sbin"; - src = ./modprobe; - isExecutable = true; - inherit (pkgs) module_init_tools; - inherit (config.system) modulesTree; - }; - description = '' - Wrapper around modprobe that sets the path to the modules - tree. - ''; - }; - # !!! The mount option should not stay in /system/option.nix mount = mkOption { internal = true;