clipman: Add extraArgs option to clipman service

This commit is contained in:
Fae 2026-03-10 17:09:44 +00:00 committed by Austin Horstman
parent 54db7915d0
commit f0e123a7e2
4 changed files with 46 additions and 1 deletions

View file

@ -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";

View 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}
'';
}

View 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

View file

@ -2,4 +2,5 @@
lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux {
clipman-sway-session-target = ./clipman-sway-session-target.nix;
clipman-extraargs = ./clipman-extraargs.nix;
}