aboutsummaryrefslogtreecommitdiff
path: root/nix/per-host/torrents-2/configuration.nix
blob: 6e7cd490f7e5b6e797a4f0c574f4e04d494cbb6e (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
52
53
54
55
56
57
58
59
60
61
62
63
64
{ config, pkgs, modulesPath, lib, system, ... }:

{
  config = {
    sops.age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ];
    sops.defaultSopsFile = ../../secrets/torrents-2.yaml;
    # sops.secrets."foo" = {
    #   owner = "transmission";
    # };

    networking.hostName = "torrents-2";
    networking.firewall.allowedTCPPorts = [ 80 443 9091 ];

    hardware.graphics = {
      enable = true;
    };

    hardware.nvidia = {
      modesetting.enable = true;
      nvidiaPersistenced = true;
      powerManagement.enable = false;
      powerManagement.finegrained = false;
      open = false;
      nvidiaSettings = true;
      package = config.boot.kernelPackages.nvidiaPackages.legacy_580;
    };

    nixpkgs.config.allowUnfree = true;

    services.xserver.videoDrivers = [ "nvidia" ];

    sops.templates."transmission-rpc-password.json" = {
      content = ''
        {
          "rpc-password": "${config.sops.placeholder.foo}"
        }
      '';
      owner = "transmission";
      restartUnits = [ "transmission.service" ];
    };

    services.transmission = {
      enable = true;
      package = pkgs.transmission_4;
      credentialsFile = config.sops.templates."transmission-rpc-password.json".path;
      settings = {
        rpc-authentication-required = true;
        rpc-username = "kdam0";
        # testpass
        # rpc-password = "{b55cdbfcac290fff79d3bdb3441082dca8f278aay.bodWGn";
        # rpc-password-file = config.sops.secrets."foo".path;
        rpc-bind-address = "0.0.0.0";
        # rpc-host-whitelist = "torrents2.kumardamani.net";
        rpc-whitelist-enabled = true;
        rpc-whitelist = "127.0.0.1,10.10.*.*";
      };
    };

    fileSystems."/mnt/data" = {
      device = "nas.bacala:/mnt/tank/customers/kumar/media";
      fsType = "nfs";
    };
  };
}