mirror of
https://github.com/nix-community/home-manager
synced 2024-11-26 21:19:45 +01:00
cliphist: add extraOptions option
Add an extraOptions option that would be appended to the cliphist command.
This commit is contained in:
parent
2a44f4d09f
commit
f69bf670d2
3 changed files with 40 additions and 4 deletions
|
@ -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 {
|
systemdTarget = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "graphical-session.target";
|
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 = [
|
assertions = [
|
||||||
(lib.hm.assertions.assertPlatform "services.cliphist" pkgs
|
(lib.hm.assertions.assertPlatform "services.cliphist" pkgs
|
||||||
lib.platforms.linux)
|
lib.platforms.linux)
|
||||||
|
@ -48,7 +57,7 @@ in {
|
||||||
Service = {
|
Service = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart =
|
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";
|
Restart = "on-failure";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,7 +73,7 @@ in {
|
||||||
Service = {
|
Service = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart =
|
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";
|
Restart = "on-failure";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
24
tests/modules/services/cliphist/cliphist-extra-options.nix
Normal file
24
tests/modules/services/cliphist/cliphist-extra-options.nix
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{ ... }: {
|
||||||
|
services.cliphist = {
|
||||||
|
enable = true;
|
||||||
|
allowImages = true;
|
||||||
|
extraOptions = [ "-max-dedupe-search" "10" "-max-items" "500" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
test.stubs = {
|
||||||
|
cliphist = { };
|
||||||
|
wl-clipboard = { };
|
||||||
|
};
|
||||||
|
|
||||||
|
nmt.script = ''
|
||||||
|
servicePath=home-files/.config/systemd/user
|
||||||
|
|
||||||
|
assertFileExists $servicePath/cliphist.service
|
||||||
|
assertFileExists $servicePath/cliphist-images.service
|
||||||
|
|
||||||
|
assertFileRegex $servicePath/cliphist.service " '-max-dedupe-search' '10' "
|
||||||
|
assertFileRegex $servicePath/cliphist.service " '-max-items' '500' "
|
||||||
|
assertFileRegex $servicePath/cliphist-images.service " '-max-dedupe-search' '10' "
|
||||||
|
assertFileRegex $servicePath/cliphist-images.service " '-max-items' '500' "
|
||||||
|
'';
|
||||||
|
}
|
|
@ -1 +1,4 @@
|
||||||
{ cliphist-sway-session-target = ./cliphist-sway-session-target.nix; }
|
{
|
||||||
|
cliphist-sway-session-target = ./cliphist-sway-session-target.nix;
|
||||||
|
cliphist-extra-options = ./cliphist-extra-options.nix;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue