Ensure that systemd-modules-load is restarted when boot.kernelModules changes
This commit is contained in:
parent
71a541afb6
commit
d63da5892c
@ -2,7 +2,16 @@
|
|||||||
|
|
||||||
with pkgs.lib;
|
with pkgs.lib;
|
||||||
|
|
||||||
let kernel = config.boot.kernelPackages.kernel; in
|
let
|
||||||
|
|
||||||
|
kernel = config.boot.kernelPackages.kernel;
|
||||||
|
|
||||||
|
kernelModulesConf = pkgs.writeText "nixos.conf"
|
||||||
|
''
|
||||||
|
${concatStringsSep "\n" config.boot.kernelModules}
|
||||||
|
'';
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -197,10 +206,27 @@ let kernel = config.boot.kernelPackages.kernel; in
|
|||||||
# this file changes.
|
# this file changes.
|
||||||
environment.etc = singleton
|
environment.etc = singleton
|
||||||
{ target = "modules-load.d/nixos.conf";
|
{ target = "modules-load.d/nixos.conf";
|
||||||
source = pkgs.writeText "nixos.conf"
|
source = kernelModulesConf;
|
||||||
''
|
};
|
||||||
${concatStringsSep "\n" config.boot.kernelModules}
|
|
||||||
'';
|
# Sigh. This overrides systemd's systemd-modules-load.service
|
||||||
|
# just so we can set a restart trigger. Also make
|
||||||
|
# multi-user.target pull it in so that it gets started if it
|
||||||
|
# failed earlier.
|
||||||
|
boot.systemd.services."systemd-modules-load" =
|
||||||
|
{ description = "Load Kernel Modules";
|
||||||
|
wantedBy = [ "sysinit.target" "multi-user.target" ];
|
||||||
|
before = [ "sysinit.target" "shutdown.target" ];
|
||||||
|
unitConfig =
|
||||||
|
{ DefaultDependencies = "no";
|
||||||
|
Conflicts = "shutdown.target";
|
||||||
|
};
|
||||||
|
serviceConfig =
|
||||||
|
{ Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
ExecStart = "${config.system.build.systemd}/lib/systemd/systemd-modules-load";
|
||||||
|
};
|
||||||
|
restartTriggers = [ kernelModulesConf ];
|
||||||
};
|
};
|
||||||
|
|
||||||
lib.kernelConfig = {
|
lib.kernelConfig = {
|
||||||
|
@ -76,7 +76,7 @@ let
|
|||||||
"systemd-update-utmp-shutdown.service"
|
"systemd-update-utmp-shutdown.service"
|
||||||
|
|
||||||
# Kernel module loading.
|
# Kernel module loading.
|
||||||
"systemd-modules-load.service"
|
#"systemd-modules-load.service"
|
||||||
|
|
||||||
# Filesystems.
|
# Filesystems.
|
||||||
"systemd-fsck@.service"
|
"systemd-fsck@.service"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user