diff options
author | Silvan Mosberger <contact@infinisil.com> | 2020-02-06 18:11:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-06 18:11:01 +0100 |
commit | 5acd16842536b34ad1a9299d456b49709fbb385e (patch) | |
tree | a62e2db5bf21b5c5078b8cb8cd94c0aea7ec6bd9 /nixos/modules/system | |
parent | bead83efa57bbcdb14f4c63baa577144ebed3c07 (diff) | |
parent | 0017a06717bb18706ac3cb99432034caad0c8b91 (diff) |
Merge pull request #59827 from oxij/nixos/suppress-systemd-units
nixos/systemd: add an option to suppress system units
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/systemd.nix | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/nixos/modules/system/boot/systemd.nix b/nixos/modules/system/boot/systemd.nix index 2a5b3608311a..cdc9d2379392 100644 --- a/nixos/modules/system/boot/systemd.nix +++ b/nixos/modules/system/boot/systemd.nix @@ -786,6 +786,18 @@ in ''; }; + systemd.suppressedSystemUnits = mkOption { + default = [ ]; + type = types.listOf types.str; + example = [ "systemd-backlight@.service" ]; + description = '' + A list of units to suppress when generating system systemd configuration directory. This has + priority over upstream units, <option>systemd.units</option>, and + <option>systemd.additionalUpstreamSystemUnits</option>. The main purpose of this is to + suppress a upstream systemd unit with any modifications made to it by other NixOS modules. + ''; + }; + }; @@ -818,8 +830,11 @@ in done ${concatStrings (mapAttrsToList (exec: target: "ln -s ${target} $out/${exec};\n") links)} ''; + + enabledUpstreamSystemUnits = filter (n: ! elem n cfg.suppressedSystemUnits) upstreamSystemUnits; + enabledUnits = filterAttrs (n: v: ! elem n cfg.suppressedSystemUnits) cfg.units; in ({ - "systemd/system".source = generateUnits "system" cfg.units upstreamSystemUnits upstreamSystemWants; + "systemd/system".source = generateUnits "system" enabledUnits enabledUpstreamSystemUnits upstreamSystemWants; "systemd/user".source = generateUnits "user" cfg.user.units upstreamUserUnits []; |