aboutsummaryrefslogtreecommitdiffstats
path: root/modules/scripts/default.nix
blob: 68b4000ccaed059ad44e88f3bbb019f2cac53836 (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
{
  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) (
        mkScript "vpn-connect" ./vpn-connect.sh
      ))
    ];
  };
}