about summary refs log tree commit diff
path: root/home/profiles/workstation.nix
blob: 60ba6ad5b205d999f79c6ca1f7a7dc7b84e1c0ad (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
{ config, lib, pkgs, ... }:
let
  restic-nas = pkgs.writeShellApplication
    {
      name = "restic-nas";
      runtimeInputs = [ pkgs.restic pkgs.tailscale pkgs.jq ];
      text = ''
        NAS=$(tailscale status --json | jq -r '.Peer | map(select(.HostName == "tahoe"))[0].TailscaleIPs[0]')

        RESTIC_REPOSITORY="sftp:''${NAS}:/$(hostname)"
        export RESTIC_REPOSITORY
        export RESTIC_PASSWORD_FILE=/run/agenix/restic/repo-users

        sudo -E restic -o sftp.command="ssh backup@''${NAS} -i /run/agenix/restic/ssh-key -s sftp" "$@"
      '';
    };

  album-to-nas = pkgs.writeShellApplication {
    name = "album-to-nas";
    runtimeInputs = [ pkgs.jq pkgs.tailscale ];
    text = ''
      ALBUM_PATH="$1"

      NAS=$(tailscale status --json | 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
{
  imports = [
    ./alacritty.nix
    ./dev.nix
    ./emacs.nix
    ./firefox.nix
    ./tmux.nix
    ./yubikey.nix
    ./ytdlp.nix
  ];

  home.packages = with pkgs; [
    # media
    gnome3.eog
    gnome3.evince
    sublime-music
    vlc
    yt-dlp

    passage
    tree

    element-desktop-wayland

    # scanning
    tesseract
    imagemagick
    exiftool
    sane-airscan

    transmission-remote-gtk

    # custom tools
    album-to-nas
    restic-nas

    # tools from external repositories
    # x509-info
    # gh-ssh-keys
    # masked-emails
  ];

  programs.feh.enable = true;
  programs.mpv = {
    enable = true;
    config = {
      sub-auto = "fuzzy";
      vo = "gpu";
      hwdec = "auto-safe";
      gpu-context = "wayland";
      audio-display = "no";
      cache-pause = "no";
      cache = "yes";
      mute = "no";
      osc = "yes";
      screenshot-directory = "~/documents/screenshots/mpv-screenshots/";
      screenshot-format = "png";
    };
    scripts = lib.attrVals [ "sponsorblock" ] pkgs.mpvScripts;
  };

  services.gammastep = {
    enable = true;
    #TODO: this needs to come from locale.nix
    latitude = 37.8715;
    longitude = -122.273;
    temperature = {
      day = 5000;
      night = 3700;
    };
  };

  home.sessionVariables = {
    PASSAGE_DIR = "${config.xdg.dataHome}/passage/store";
    PASSAGE_IDENTITIES_FILE = "${config.xdg.dataHome}/passage/identities";
    # for now I have to default to rage, as the version of age is
    # not recent enough to work with keys generated by
    # age-plugin-yubikey
    PASSAGE_AGE = "${pkgs.rage}/bin/rage";
  };

  # enable bluetooth
  services.blueman-applet.enable = true;
}