diff --git a/modules/services/syncthing.nix b/modules/services/syncthing.nix index 667ba21ea..b9324cf34 100644 --- a/modules/services/syncthing.nix +++ b/modules/services/syncthing.nix @@ -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." - ]; - }) ]; } diff --git a/tests/modules/services/syncthing/linux/default.nix b/tests/modules/services/syncthing/linux/default.nix index 14136fe63..da4505040 100644 --- a/tests/modules/services/syncthing/linux/default.nix +++ b/tests/modules/services/syncthing/linux/default.nix @@ -1,4 +1,3 @@ { syncthing-tray = ./tray.nix; - syncthing-tray-as-bool-triggers-warning = ./tray-as-bool-triggers-warning.nix; } diff --git a/tests/modules/services/syncthing/linux/tray-as-bool-triggers-warning.nix b/tests/modules/services/syncthing/linux/tray-as-bool-triggers-warning.nix deleted file mode 100644 index 355da3214..000000000 --- a/tests/modules/services/syncthing/linux/tray-as-bool-triggers-warning.nix +++ /dev/null @@ -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 - ''; -}