forked from lordkekz/nix-yazi-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.nix
66 lines (64 loc) · 1.24 KB
/
lib.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
58
59
60
61
62
63
64
65
66
{ lib, ... }:
let
inherit (lib) mkOption isList;
inherit (lib.types)
submodule
str
either
listOf
;
in
{
setKeys = keys: {
programs.yazi.keymap.manager.prepend_keymap = lib.mapAttrsToList (_: key: {
inherit (key) on run desc;
}) keys;
};
mkRuntimeDeps =
{ pkgs }:
mkOption {
type = lib.types.listOf (lib.types.either lib.types.package lib.types.str);
description = ''
Additional runtime packages to add
to deactivate overlaying `lib.mkForce []` the parent option
'';
default = pkgs;
};
mkKeyOption =
{
on,
run,
desc,
}:
mkOption {
description = desc;
type = either (submodule {
options = {
on = mkOption {
type = listOf str;
default = on;
};
run = mkOption {
type = str;
default = run;
};
desc = mkOption {
type = str;
default = desc;
};
};
}) (listOf str);
default = {
inherit on run desc;
};
apply =
old:
if isList old then
{
on = old;
run = run;
}
else
old;
};
}