1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

syncthing: remove deprecated code

Specifically, in 2021 the use of `services.syncthing.tray` as a
Boolean was deprecated. This removes the associated code.
This commit is contained in:
Robert Helgesson 2025-09-25 08:43:39 +02:00
parent 74a78aacb7
commit ade850153b
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED
3 changed files with 22 additions and 76 deletions

View file

@ -738,38 +738,28 @@ in
package = lib.mkPackageOption pkgs "syncthing" { };
tray = mkOption {
type =
with types;
either bool (submodule {
options = {
enable = mkOption {
type = bool;
default = false;
description = "Whether to enable a syncthing tray service.";
};
command = mkOption {
type = str;
default = "syncthingtray --wait";
defaultText = literalExpression "syncthingtray --wait";
example = literalExpression "qsyncthingtray";
description = "Syncthing tray command to use.";
};
package = mkOption {
type = package;
default = pkgs.syncthingtray-minimal;
defaultText = literalExpression "pkgs.syncthingtray-minimal";
example = literalExpression "pkgs.qsyncthingtray";
description = "Syncthing tray package to use.";
};
};
});
default = {
enable = false;
tray = {
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable a syncthing tray service.";
};
command = mkOption {
type = types.str;
default = "syncthingtray --wait";
defaultText = literalExpression "syncthingtray --wait";
example = literalExpression "qsyncthingtray";
description = "Syncthing tray command to use.";
};
package = mkOption {
type = types.package;
default = pkgs.syncthingtray-minimal;
defaultText = literalExpression "pkgs.syncthingtray-minimal";
example = literalExpression "pkgs.qsyncthingtray";
description = "Syncthing tray package to use.";
};
description = "Syncthing tray service configuration.";
};
};
};
@ -871,7 +861,7 @@ in
};
})
(lib.mkIf (lib.isAttrs cfg.tray && cfg.tray.enable) {
(lib.mkIf cfg.tray.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.syncthing.tray" pkgs lib.platforms.linux)
];
@ -898,37 +888,5 @@ in
};
};
})
# deprecated
(lib.mkIf (lib.isBool cfg.tray && cfg.tray) {
assertions = [
(lib.hm.assertions.assertPlatform "services.syncthing.tray" pkgs lib.platforms.linux)
];
systemd.user.services = {
"syncthingtray" = {
Unit = {
Description = "syncthingtray";
Requires = [ "tray.target" ];
After = [
"graphical-session.target"
"tray.target"
];
PartOf = [ "graphical-session.target" ];
};
Service = {
ExecStart = "${pkgs.syncthingtray-minimal}/bin/syncthingtray --wait";
};
Install = {
WantedBy = [ "graphical-session.target" ];
};
};
};
warnings = [
"Specifying 'services.syncthing.tray' as a boolean is deprecated, set 'services.syncthing.tray.enable' instead. See https://github.com/nix-community/home-manager/pull/1257."
];
})
];
}

View file

@ -1,4 +1,3 @@
{
syncthing-tray = ./tray.nix;
syncthing-tray-as-bool-triggers-warning = ./tray-as-bool-triggers-warning.nix;
}

View file

@ -1,11 +0,0 @@
{
services.syncthing.tray = true;
test.asserts.warnings.expected = [
"Specifying 'services.syncthing.tray' as a boolean is deprecated, set 'services.syncthing.tray.enable' instead. See https://github.com/nix-community/home-manager/pull/1257."
];
nmt.script = ''
assertFileExists home-files/.config/systemd/user/syncthingtray.service
'';
}