about summary refs log tree commit diff
path: root/home/packages/default.nix
blob: 265a767301e77fcf8d99ac28fbe1ec7971b3c6d9 (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
{ 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
      ([
        util-linux
        jq
        ripgrep

        # custom tools
        album-to-nas
        tools.ipconverter
        tools.seqstat
        tools.git-blame-stats
        x509-info
        gh-ssh-keys
      ]
      ++ cfg.additionalPackages);
}