nixos: move environment.{variables => sessionVariables}.MODULE_DIR
This solves the problem that modprobe does not know about $MODULE_DIR when run via sudo, and instead wrongly tries to read /lib/modules/: $ sudo strace -efile modprobe foo |& grep modules open("/lib/modules/3.14.37/modules.softdep", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/modules/3.14.37/modules.dep.bin", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/modules/3.14.37/modules.dep.bin", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) open("/lib/modules/3.14.37/modules.alias.bin", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) Without this patch, one would have to use sudo -E (preserves environment vars). But that option is reserved for sudo users with extra rights (SETENV), so it's not a solution. environment.sessionVariables are set by PAM, so they are included in the environment used by sudo.
This commit is contained in:
parent
c72bbc5b8e
commit
74d5adcb4d
|
@ -101,7 +101,7 @@ with lib;
|
|||
echo ${config.system.sbin.modprobe}/sbin/modprobe > /proc/sys/kernel/modprobe
|
||||
'';
|
||||
|
||||
environment.variables.MODULE_DIR = "/run/current-system/kernel-modules/lib/modules";
|
||||
environment.sessionVariables.MODULE_DIR = "/run/current-system/kernel-modules/lib/modules";
|
||||
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue