From f0e123a7e203974dd010fd09e07f44ad39ade5f8 Mon Sep 17 00:00:00 2001 From: Fae Date: Tue, 10 Mar 2026 17:09:44 +0000 Subject: [PATCH] clipman: Add extraArgs option to clipman service --- modules/services/clipman.nix | 16 +++++++++++++++- .../services/clipman/clipman-extraargs.nix | 16 ++++++++++++++++ .../services/clipman/clipman-extraargs.service | 14 ++++++++++++++ tests/modules/services/clipman/default.nix | 1 + 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 tests/modules/services/clipman/clipman-extraargs.nix create mode 100644 tests/modules/services/clipman/clipman-extraargs.service diff --git a/modules/services/clipman.nix b/modules/services/clipman.nix index d61605b8..dd5d1e67 100644 --- a/modules/services/clipman.nix +++ b/modules/services/clipman.nix @@ -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"; diff --git a/tests/modules/services/clipman/clipman-extraargs.nix b/tests/modules/services/clipman/clipman-extraargs.nix new file mode 100644 index 00000000..07bec907 --- /dev/null +++ b/tests/modules/services/clipman/clipman-extraargs.nix @@ -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} + ''; +} diff --git a/tests/modules/services/clipman/clipman-extraargs.service b/tests/modules/services/clipman/clipman-extraargs.service new file mode 100644 index 00000000..7a71b2f9 --- /dev/null +++ b/tests/modules/services/clipman/clipman-extraargs.service @@ -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 diff --git a/tests/modules/services/clipman/default.nix b/tests/modules/services/clipman/default.nix index 639fccb7..0b06ba7b 100644 --- a/tests/modules/services/clipman/default.nix +++ b/tests/modules/services/clipman/default.nix @@ -2,4 +2,5 @@ lib.optionalAttrs pkgs.stdenv.hostPlatform.isLinux { clipman-sway-session-target = ./clipman-sway-session-target.nix; + clipman-extraargs = ./clipman-extraargs.nix; }