blob: c312800e9c88ae025326382c005268197e836ed5 (
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
|
{
config,
lib,
pkgs,
...
}:
# Scripts - Home directory shell scripts (deep-clean, screen-recording, system-monitor)
let
mkScript =
name: path:
pkgs.writeShellScriptBin name ''
#!${
if config.tools.zsh.enable then (lib.getExe config.programs.zsh.package) else "#!/usr/bin/env sh"
}
${builtins.readFile path}
'';
in
{
config = {
home.packages = [
# Always included
(mkScript "deep-clean" ./deep-clean.sh)
# Conditional scripts (requies some tools)
(lib.mkIf (config.tools.ffmpeg.enable && config.tools.slop.enable) (
mkScript "screen-recording" ./screen-recording.sh
))
(lib.mkIf (
config.tools.bottom.enable
&& config.tools.nvtop.enable
&& config.tools.tmux.enable
&& config.tools.kitty.enable
) (mkScript "system-monitor" ./system-monitor.sh))
(lib.mkIf (config.tools.openvpn.enable && config.tools.fzf.enable) (
pkgs.writeShellScriptBin "vpn-connect" ''
#!${if config.tools.zsh.enable then (lib.getExe config.programs.zsh.package) else "/usr/bin/env sh"}
# Inject Nix store paths as environment variables for the script to use
export FZF_BIN="${lib.getExe pkgs.fzf}"
export OPENVPN_BIN="${lib.getExe pkgs.openvpn}"
export RESOLVED_BIN="${pkgs.openvpn}/libexec/update-systemd-resolved"
${builtins.readFile ./vpn-connect.sh}
''
))
];
};
}
|