diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-17 18:52:31 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-17 18:52:31 +0200 |
commit | 179acfb664ed06519ac515eada7bbef677cbee87 (patch) | |
tree | 76c599294fe8ce8530b92c8a36f9b2adc7ee0595 /nixos/modules/system/boot/kernel.nix | |
parent | 8dcf76480c34520997816d1bf4cfd68c6280ebbd (diff) | |
download | nixlib-179acfb664ed06519ac515eada7bbef677cbee87.tar nixlib-179acfb664ed06519ac515eada7bbef677cbee87.tar.gz nixlib-179acfb664ed06519ac515eada7bbef677cbee87.tar.bz2 nixlib-179acfb664ed06519ac515eada7bbef677cbee87.tar.lz nixlib-179acfb664ed06519ac515eada7bbef677cbee87.tar.xz nixlib-179acfb664ed06519ac515eada7bbef677cbee87.tar.zst nixlib-179acfb664ed06519ac515eada7bbef677cbee87.zip |
Allow upstream systemd units to be extended
If you define a unit, and either systemd or a package in systemd.packages already provides that unit, then we now generate a file /etc/systemd/system/<unit>.d/overrides.conf. This makes it possible to use upstream units, while allowing them to be customised from the NixOS configuration. For instance, the module nix-daemon.nix now uses the units provided by the Nix package. And all unit definitions that duplicated upstream systemd units are finally gone. This makes the baseUnit option unnecessary, so I've removed it.
Diffstat (limited to 'nixos/modules/system/boot/kernel.nix')
-rw-r--r-- | nixos/modules/system/boot/kernel.nix | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/nixos/modules/system/boot/kernel.nix b/nixos/modules/system/boot/kernel.nix index 2e036fafae60..5e5b2abbb9ca 100644 --- a/nixos/modules/system/boot/kernel.nix +++ b/nixos/modules/system/boot/kernel.nix @@ -147,12 +147,6 @@ in config = mkIf (!config.boot.isContainer) { - systemd.services.kmod-static-nodes = - { wantedBy = [ "sysinit.target" ]; - baseUnit = "${config.systemd.package}/example/systemd/system/kmod-static-nodes.service"; - environment.MODULE_DIR = "/run/booted-system/kernel-modules/lib/modules"; - }; - system.build = { inherit kernel; }; system.modulesTree = [ kernel ] ++ config.boot.extraModulePackages; @@ -224,37 +218,26 @@ in # Create /etc/modules-load.d/nixos.conf, which is read by # systemd-modules-load.service to load required kernel modules. - # FIXME: ensure that systemd-modules-load.service is restarted if - # this file changes. environment.etc = singleton { target = "modules-load.d/nixos.conf"; 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. systemd.services."systemd-modules-load" = - { description = "Load Kernel Modules"; - wantedBy = [ "sysinit.target" "multi-user.target" ]; - before = [ "sysinit.target" "shutdown.target" ]; - conflicts = [ "shutdown.target" ]; - unitConfig = - { DefaultDependencies = false; - ConditionCapability = "CAP_SYS_MODULE"; - }; + { wantedBy = [ "multi-user.target" ]; + restartTriggers = [ kernelModulesConf ]; + environment.MODULE_DIR = "/run/booted-system/kernel-modules/lib/modules"; serviceConfig = - { Type = "oneshot"; - RemainAfterExit = true; - ExecStart = "${config.systemd.package}/lib/systemd/systemd-modules-load"; - # Ignore failed module loads. Typically some of the + { # Ignore failed module loads. Typically some of the # modules in ‘boot.kernelModules’ are "nice to have but # not required" (e.g. acpi-cpufreq), so we don't want to # barf on those. SuccessExitStatus = "0 1"; }; - restartTriggers = [ kernelModulesConf ]; + }; + + systemd.services.kmod-static-nodes = + { wantedBy = [ "sysinit.target" ]; environment.MODULE_DIR = "/run/booted-system/kernel-modules/lib/modules"; }; |