cliphist: add maxDedupeSearch and maxItems options
Add the maxDedupeSearch and maxItems options that correspond to cliphist's -max-dedupe-search and -max-items flags respectively.
This commit is contained in:
parent
6d3b6dc922
commit
3489474672
|
@ -17,6 +17,22 @@ in {
|
|||
'';
|
||||
};
|
||||
|
||||
maxDedupeSearch = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 100;
|
||||
description = ''
|
||||
Maximum number of last items to look through when finding duplicates.
|
||||
'';
|
||||
};
|
||||
|
||||
maxItems = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 750;
|
||||
description = ''
|
||||
Maximum number of items to store.
|
||||
'';
|
||||
};
|
||||
|
||||
systemdTarget = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "graphical-session.target";
|
||||
|
@ -31,7 +47,11 @@ in {
|
|||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
config = let
|
||||
cliphistFlags =
|
||||
"-max-dedupe-search ${builtins.toString cfg.maxDedupeSearch} "
|
||||
+ "-max-items ${builtins.toString cfg.maxItems}";
|
||||
in lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
(lib.hm.assertions.assertPlatform "services.cliphist" pkgs
|
||||
lib.platforms.linux)
|
||||
|
@ -48,7 +68,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 ${cliphistFlags} store";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
|
@ -64,7 +84,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 ${cliphistFlags} store";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
services.cliphist = {
|
||||
enable = true;
|
||||
allowImages = true;
|
||||
maxDedupeSearch = 10;
|
||||
maxItems = 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-flags = ./cliphist-extra-flags.nix;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue