forked from nix-community/nixvim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
clipboard.nix
57 lines (54 loc) · 1.24 KB
/
clipboard.nix
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
{
config,
lib,
pkgs,
...
}:
with lib; let
cfg = config.clipboard;
in {
options = {
clipboard = {
register = mkOption {
description = ''
Sets the register to use for the clipboard.
Learn more at https://neovim.io/doc/user/options.html#'clipboard'.
'';
type = with types;
nullOr
(either str (listOf str));
default = null;
example = "unnamedplus";
};
providers = mkOption {
type = types.submodule {
options =
mapAttrs
(
name: packageName: {
enable = mkEnableOption name;
package = mkPackageOption pkgs packageName {};
}
)
{
wl-copy = "wl-clipboard";
xclip = "xclip";
xsel = "xsel";
};
};
default = {};
description = ''
Package(s) to use as the clipboard provider.
Learn more at `:h clipboard`.
'';
};
};
};
config = {
options.clipboard = mkIf (cfg.register != null) cfg.register;
extraPackages =
mapAttrsToList
(n: v: v.package)
(filterAttrs (n: v: v.enable) cfg.providers);
};
}