nix-da/options/services/cliphist.nix

46 lines
1.1 KiB
Nix

{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.modules.services.cliphist;
in
{
options.modules.services.cliphist = {
enable = mkEnableOption "cliphist, a clipboard history manager for wayland";
package = lib.mkPackageOption pkgs "cliphist" { };
extraOptions = lib.mkOption {
type = with lib.types; listOf str;
default = [
"-max-items"
"250"
];
description = ''
Flags to append to the cliphist command.
'';
apply = lib.escapeShellArgs;
};
};
config = mkIf cfg.enable {
systemd.user.services.cliphist = {
description = "Clipboard management daemon";
after = [ "graphical-session.target" ];
wantedBy = [ "graphical-session.target" ];
serviceConfig = {
Type = "simple";
ExecStart = "${pkgs.wl-clipboard}/bin/wl-paste --watch ${cfg.package}/bin/cliphist ${cfg.extraOptions} store";
Restart = "on-failure";
} // lib.my.systemdHardening;
postStop = "${cfg.package}/bin/cliphist wipe";
};
environment.systemPackages = [ cfg.package ];
};
}