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