blob: c70c3a02e022e3c06c21b806ee4dd355f35cdc12 (
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
|
{
config,
lib,
pkgs,
utils,
...
}:
let
scriptUtils = utils.scripts { inherit pkgs lib config; };
scripts = {
deep-clean = scriptUtils.mkScript "deep-clean" ./deep-clean.sh { };
fzf-launcher = lib.mkIf config.tools.fzf.enable (
scriptUtils.mkScript "fzf-launcher" ./fzf-launcher.sh {
FZF = lib.getExe pkgs.fzf;
SETSID = lib.getExe' pkgs.util-linux "setsid";
}
);
screen-recording = lib.mkIf (config.tools.ffmpeg.enable && config.tools.slop.enable) (
scriptUtils.mkScript "screen-recording" ./screen-recording.sh {
FFMPEG = lib.getExe pkgs.ffmpeg-full;
SLOP = lib.getExe pkgs.slop;
}
);
system-monitor =
lib.mkIf
(
config.tools.bottom.enable
&& config.tools.nvtop.enable
&& config.tools.tmux.enable
&& config.tools.kitty.enable
)
(
scriptUtils.mkScript "system-monitor" ./system-monitor.sh {
BTM = lib.getExe pkgs.bottom;
NVTOP = lib.getExe pkgs.nvtopPackages.full;
TMUX = lib.getExe pkgs.tmux;
KITTY = lib.getExe pkgs.kitty;
}
);
vpn-connect = lib.mkIf (config.tools.openvpn.enable && config.tools.fzf.enable) (
scriptUtils.mkScript "vpn-connect" ./vpn-connect.sh {
FZF = lib.getExe pkgs.fzf;
OPENVPN = lib.getExe pkgs.openvpn;
SYSTEMD_RESOLVED = "${pkgs.openvpn}/libexec/update-systemd-resolved";
}
);
vpn-disconnect = lib.mkIf (config.tools.openvpn.enable && config.tools.fzf.enable) (
scriptUtils.mkScript "vpn-disconnect" ./vpn-disconnect.sh { }
);
};
in
{
options.scripts = lib.mapAttrs (
name: _:
lib.mkOption {
type = lib.types.nullOr lib.types.package;
default = null;
description = "Derivation for the ${name} script, or null if disabled.";
}
) scripts;
config = {
scripts = scripts;
home.packages = lib.filter (x: x != null) (lib.mapAttrsToList (_: v: lib.mkIf true v) scripts);
};
}
|