blob: ca9e5a093d6642480d167a303a40a31a3712ab6a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.stash-clipboard;
inherit (lib)
mkPackageOption
mkEnableOption
mkOption
types
mkIf
getExe
concatStringsSep
;
in
{
options.services.stash-clipboard = {
enable = mkEnableOption "stash, a Wayland clipboard manager";
package = mkPackageOption pkgs [ "stash-clipboard" ] { };
arguments = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "--max-items 10" ];
description = ''
A list of arguments which are passed to `stash`. For a list of available arguments, run `stash --help`.
'';
};
serviceArguments = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "--persist" ];
description = ''
A list of arguments which are passed to `stash watch`. For a list of available arguments, run `stash watch --help`.
'';
};
filterFile = mkOption {
type = types.str;
default = "";
example = "/etc/stash/clipboard_filter";
description = ''
Stash can be configured to avoid storing clipboard entries that match a sensitive pattern, using a regular expression.
The file set here should contain your regex pattern (no quotes).
Example regex to block common password patterns:
- (password|secret|api[_-]?key|token)[=: ]+[^\s]+
'';
};
excludedApps = mkOption {
type = types.listOf types.str;
default = [ ];
example = [ "Bitwarden" ];
description = ''
List of application classes to exclude from the database.
Entries from these apps are still copied to the clipboard, but it will never be put inside the database.
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
systemd = {
user.services.stash-clipboard = {
description = "Stash clipboard manager daemon";
wantedBy = [ "graphical-session.target" ];
after = [ "graphical-session.target" ];
serviceConfig = {
ExecStart = "${getExe cfg.package} ${concatStringsSep " " cfg.arguments} watch ${concatStringsSep " " cfg.serviceArguments}";
LoadCredential = mkIf (cfg.filterFile != "") "clipboard_filter:${cfg.filterFile}";
};
environment = mkIf (cfg.excludedApps != [ ]) {
STASH_EXCLUDED_APPS = concatStringsSep "," cfg.excludedApps;
};
};
};
};
}
|