mirror of
https://github.com/nix-community/home-manager.git
synced 2026-06-05 21:02:51 +00:00
clipman: Add extraArgs option to clipman service
This commit is contained in:
@@ -28,6 +28,18 @@ in
|
||||
otherwise the service may never be started.
|
||||
'';
|
||||
};
|
||||
|
||||
extraArgs = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ ];
|
||||
example = [
|
||||
"--max-items"
|
||||
"100"
|
||||
];
|
||||
description = ''
|
||||
Extra arguments to be passed to the clipman executable.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
@@ -46,7 +58,9 @@ in
|
||||
};
|
||||
|
||||
Service = {
|
||||
ExecStart = "${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${cfg.package}/bin/clipman store";
|
||||
ExecStart =
|
||||
"${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${cfg.package}/bin/clipman store"
|
||||
+ lib.optionalString (cfg.extraArgs != [ ]) " ${lib.escapeShellArgs cfg.extraArgs}";
|
||||
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
|
||||
Restart = "on-failure";
|
||||
KillMode = "mixed";
|
||||
|
||||
16
tests/modules/services/clipman/clipman-extraargs.nix
Normal file
16
tests/modules/services/clipman/clipman-extraargs.nix
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
home.stateVersion = "21.11";
|
||||
|
||||
services.clipman = {
|
||||
enable = true;
|
||||
extraArgs = [
|
||||
"--max-items"
|
||||
"123"
|
||||
];
|
||||
};
|
||||
|
||||
nmt.script = ''
|
||||
serviceFile=$(normalizeStorePaths home-files/.config/systemd/user/clipman.service)
|
||||
assertFileContent "$serviceFile" ${./clipman-extraargs.service}
|
||||
'';
|
||||
}
|
||||
14
tests/modules/services/clipman/clipman-extraargs.service
Normal file
14
tests/modules/services/clipman/clipman-extraargs.service
Normal file
@@ -0,0 +1,14 @@
|
||||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
|
||||
[Service]
|
||||
ExecReload=/nix/store/00000000000000000000000000000000-coreutils/bin/kill -SIGUSR2 $MAINPID
|
||||
ExecStart=@wl-clipboard@/bin/wl-paste -t text --watch @clipman@/bin/clipman store --max-items 123
|
||||
KillMode=mixed
|
||||
Restart=on-failure
|
||||
|
||||
[Unit]
|
||||
After=graphical-session.target
|
||||
ConditionEnvironment=WAYLAND_DISPLAY
|
||||
Description=Clipboard management daemon
|
||||
PartOf=graphical-session.target
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
|
||||
clipman-sway-session-target = ./clipman-sway-session-target.nix;
|
||||
clipman-extraargs = ./clipman-extraargs.nix;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user