nixos/systemd: add an option to suppress system units
This commit is contained in:
parent
9289a39a69
commit
0017a06717
@ -742,6 +742,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.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -771,8 +783,11 @@ in
|
||||
done;
|
||||
${concatStrings (mapAttrsToList (generator: target: "ln -s ${target} $out/${generator};\n") cfg.generators)}
|
||||
'';
|
||||
|
||||
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 [];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user