1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-12-15 05:21:06 +01:00

cliphist: support multiple systemdTargets properly (#5669)

Using a space separated list of targets as a single string element in
the list doesn't work properly. Change property to support list of
targets and backwards compatibility with warning for single string.
This commit is contained in:
Austin Horstman 2025-01-29 12:26:13 -06:00 committed by GitHub
parent 5dc1c2e404
commit c4650fb9c0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 47 additions and 8 deletions

View file

@ -3,6 +3,14 @@ let cfg = config.services.cliphist;
in {
meta.maintainers = [ lib.hm.maintainers.janik ];
imports = [
(lib.mkRenamedOptionModule [ "services" "cliphist" "systemdTarget" ] [
"services"
"cliphist"
"systemdTargets"
])
];
options.services.cliphist = {
enable =
lib.mkEnableOption "cliphist, a clipboard history manager for wayland";
@ -25,16 +33,18 @@ in {
'';
};
systemdTarget = lib.mkOption {
type = lib.types.str;
default = "graphical-session.target";
systemdTargets = lib.mkOption {
type = with lib.types; either (listOf str) str;
default = [ "graphical-session.target" ];
example = "sway-session.target";
description = ''
The systemd target that will automatically start the cliphist service.
The systemd targets that will automatically start the cliphist service.
When setting this value to `"sway-session.target"`,
When setting this value to `["sway-session.target"]`,
make sure to also enable {option}`wayland.windowManager.sway.systemd.enable`,
otherwise the service may never be started.
Note: A single string value is deprecated, please use a list.
'';
};
};
@ -61,7 +71,7 @@ in {
Restart = "on-failure";
};
Install = { WantedBy = [ cfg.systemdTarget ]; };
Install = { WantedBy = lib.toList cfg.systemdTargets; };
};
systemd.user.services.cliphist-images = lib.mkIf cfg.allowImages {
@ -77,7 +87,7 @@ in {
Restart = "on-failure";
};
Install = { WantedBy = [ cfg.systemdTarget ]; };
Install = { WantedBy = lib.toList cfg.systemdTargets; };
};
};
}