1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-22 18:29:39 +01:00

cliphist: add extraOptions option

Add an extraOptions option that would be appended to the cliphist
command.
This commit is contained in:
Ryan 2024-05-05 15:37:54 +08:00 committed by GitHub
parent 2a44f4d09f
commit f69bf670d2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 40 additions and 4 deletions

View file

@ -17,6 +17,14 @@ in {
'';
};
extraOptions = lib.mkOption {
type = with lib.types; listOf str;
default = [ "-max-dedupe-search" "10" "-max-items" "500" ];
description = ''
Flags to append to the cliphist command.
'';
};
systemdTarget = lib.mkOption {
type = lib.types.str;
default = "graphical-session.target";
@ -31,7 +39,8 @@ in {
};
};
config = lib.mkIf cfg.enable {
config = let extraOptionsStr = lib.escapeShellArgs cfg.extraOptions;
in lib.mkIf cfg.enable {
assertions = [
(lib.hm.assertions.assertPlatform "services.cliphist" pkgs
lib.platforms.linux)
@ -48,7 +57,7 @@ in {
Service = {
Type = "simple";
ExecStart =
"${pkgs.wl-clipboard}/bin/wl-paste --watch ${cfg.package}/bin/cliphist store";
"${pkgs.wl-clipboard}/bin/wl-paste --watch ${cfg.package}/bin/cliphist ${extraOptionsStr} store";
Restart = "on-failure";
};
@ -64,7 +73,7 @@ in {
Service = {
Type = "simple";
ExecStart =
"${pkgs.wl-clipboard}/bin/wl-paste --type image --watch ${cfg.package}/bin/cliphist store";
"${pkgs.wl-clipboard}/bin/wl-paste --type image --watch ${cfg.package}/bin/cliphist ${extraOptionsStr} store";
Restart = "on-failure";
};