about summary refs log tree commit diff
path: root/home/packages/default.nix
blob: 810efaa43840193a8af6e391a97e3caf4bb10310 (plain) (blame)
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, ... }:
let
  cfg = config.my.home.packages;
  album-to-nas = pkgs.writeShellScriptBin "album-to-nas" ''
    set -euo pipefail

    ALBUM_PATH="''${1}"
    ALBUM_NAME=$(basename "''${ALBUM_PATH}")
    NAS=$(${pkgs.tailscale}/bin/tailscale status --json | ${pkgs.jq}/bin/jq -r '.Peer | map(select(.HostName == "tahoe"))[0].TailscaleIPs[0]')

    scp "''${ALBUM_PATH}" "''${NAS}:~/import/album.zip"
    ssh "''${NAS}" bc-to-beet ~/import/album.zip
  '';
in
{
  options.my.home.packages = with lib; {
    enable = mkEnableOption "user packages";
    additionalPackages = mkOption {
      type = with types; listOf package;
      default = [ ];
      example = literalExample ''
        with pkgs; [
          pavucontrol
        ]
      '';
    };
  };
  config.home.packages = with pkgs;
    lib.mkIf cfg.enable
      ([
        dive # explore layers in docker images
        jq
        ripgrep
        util-linux

        # custom tools
        album-to-nas

        # tools inside the tools directory
        tools.gha-billing
        tools.git-blame-stats
        tools.git-broom
        tools.ipconverter
        tools.seqstat

        # tools from external repositories
        x509-info
        gh-ssh-keys
      ]
      ++ cfg.additionalPackages);
}