2022-08-27 20:52:41 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
2023-06-19 16:29:55 +02:00
|
|
|
let cfg = config.services.clipman;
|
2022-08-27 20:52:41 +02:00
|
|
|
in {
|
|
|
|
meta.maintainers = [ maintainers.jwygoda ];
|
|
|
|
|
|
|
|
options.services.clipman = {
|
2023-07-02 01:45:18 +02:00
|
|
|
enable = mkEnableOption "clipman, a simple clipboard manager for Wayland";
|
2022-08-27 20:52:41 +02:00
|
|
|
|
2023-07-02 01:45:18 +02:00
|
|
|
package = mkPackageOption pkgs "clipman" { };
|
2022-08-27 20:52:41 +02:00
|
|
|
|
|
|
|
systemdTarget = mkOption {
|
|
|
|
type = types.str;
|
|
|
|
default = "graphical-session.target";
|
|
|
|
example = "sway-session.target";
|
2023-07-02 01:45:18 +02:00
|
|
|
description = ''
|
2023-06-19 16:29:55 +02:00
|
|
|
The systemd target that will automatically start the clipman service.
|
2023-07-01 01:30:13 +02:00
|
|
|
|
|
|
|
When setting this value to `"sway-session.target"`,
|
|
|
|
make sure to also enable {option}`wayland.windowManager.sway.systemd.enable`,
|
2022-08-27 20:52:41 +02:00
|
|
|
otherwise the service may never be started.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
assertions = [
|
|
|
|
(lib.hm.assertions.assertPlatform "services.clipman" pkgs
|
|
|
|
lib.platforms.linux)
|
|
|
|
];
|
|
|
|
|
|
|
|
home.packages = [ cfg.package ];
|
|
|
|
|
|
|
|
systemd.user.services.clipman = {
|
|
|
|
Unit = {
|
|
|
|
Description = "Clipboard management daemon";
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
After = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
ExecStart =
|
|
|
|
"${pkgs.wl-clipboard}/bin/wl-paste -t text --watch ${cfg.package}/bin/clipman store";
|
|
|
|
ExecReload = "${pkgs.coreutils}/bin/kill -SIGUSR2 $MAINPID";
|
|
|
|
Restart = "on-failure";
|
|
|
|
KillMode = "mixed";
|
|
|
|
};
|
|
|
|
|
|
|
|
Install = { WantedBy = [ cfg.systemdTarget ]; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|