Skip to content

Commit

Permalink
systemd: fully deprecate legacy switcher
Browse files Browse the repository at this point in the history
This switches `systemd.user.startServices = true` to be the same as
`systemd.user.startServices = "sd-switch"`, previously it would use
the "legacy" method. It also introduces a warning that triggers if the
user explicitly have `systemd.user.startServices = "legacy"`.

See #5452
  • Loading branch information
rycee committed Aug 23, 2024
1 parent 25c12f0 commit b18f3eb
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions modules/systemd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ in {
default = "suggest";
type = with types;
either bool (enum [ "suggest" "legacy" "sd-switch" ]);
apply = p: if isBool p then if p then "legacy" else "suggest" else p;
apply = p: if isBool p then if p then "sd-switch" else "suggest" else p;
description = ''
Whether new or changed services that are wanted by active targets
should be started. Additionally, stop obsolete services from the
Expand All @@ -196,17 +196,15 @@ in {
{command}`systemctl` commands to run. You will have to
manually run those commands after the switch.
`legacy` (or `true`)
`legacy`
: Use a Ruby script to, in a more robust fashion, determine the
necessary changes and automatically run the
{command}`systemctl` commands.
`sd-switch`
: Use sd-switch, a third party application, to perform the service
updates. This tool offers more features while having a small
closure size. Note, it requires a fully functional user D-Bus
session. Once tested and deemed sufficiently robust, this will
become the default.
{command}`systemctl` commands. Note, this alternative will soon
be removed.
`sd-switch` (or `true`)
: Use sd-switch, a tool that determines the necessary changes and
automatically apply them.
'';
};

Expand Down Expand Up @@ -299,6 +297,12 @@ in {
message = "This module is only available on Linux.";
}];

warnings = lib.optional (cfg.startServices == "legacy") ''
Having 'systemd.user.startServices = "legacy"' is deprecated and will soon be removed.
Please change to 'systemd.user.startServices = true' to use the new systemd unit switcher (sd-switch).
'';

xdg.configFile = mkMerge [
(lib.listToAttrs ((buildServices "service" cfg.services)
++ (buildServices "slice" cfg.slices)
Expand Down

0 comments on commit b18f3eb

Please sign in to comment.