diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-10-11 17:58:46 -0400 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2012-10-11 17:58:46 -0400 |
commit | d63da5892cf79df5d66cdc76430ccd371bd5fb71 (patch) | |
tree | 89f1b1ea91acaaec2b3da1ebe21f90caa1f66c04 /modules/system/boot/kernel.nix | |
parent | 71a541afb6cb83b896396f7b6e563abd0c8af4f5 (diff) | |
download | nixpkgs-d63da5892cf79df5d66cdc76430ccd371bd5fb71.tar nixpkgs-d63da5892cf79df5d66cdc76430ccd371bd5fb71.tar.gz nixpkgs-d63da5892cf79df5d66cdc76430ccd371bd5fb71.tar.bz2 nixpkgs-d63da5892cf79df5d66cdc76430ccd371bd5fb71.tar.lz nixpkgs-d63da5892cf79df5d66cdc76430ccd371bd5fb71.tar.xz nixpkgs-d63da5892cf79df5d66cdc76430ccd371bd5fb71.tar.zst nixpkgs-d63da5892cf79df5d66cdc76430ccd371bd5fb71.zip |
Ensure that systemd-modules-load is restarted when boot.kernelModules changes
Diffstat (limited to 'modules/system/boot/kernel.nix')
-rw-r--r-- | modules/system/boot/kernel.nix | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/modules/system/boot/kernel.nix b/modules/system/boot/kernel.nix index 8a660b90581..130adb1110a 100644 --- a/modules/system/boot/kernel.nix +++ b/modules/system/boot/kernel.nix @@ -2,7 +2,16 @@ 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. environment.etc = singleton { target = "modules-load.d/nixos.conf"; - source = pkgs.writeText "nixos.conf" - '' - ${concatStringsSep "\n" config.boot.kernelModules} - ''; + source = kernelModulesConf; + }; + + # 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 = { |