summaryrefslogtreecommitdiff
path: root/machines/iridium.nix
blob: 01e4b869bca4f03420f507180d78ae2f9a018e98 (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
65
66
{
  flake,
  pkgs,
  config,
  ...
}:
{
  nixpkgs.hostPlatform.system = "x86_64-linux";
  system.stateVersion = "25.05";
  networking.hostName = "iridium";

  imports = [
    flake.outputs.nixosModules.intel
    flake.outputs.nixosModules.network
  ];

  depot.net = {
    v6Token = "::0102";
    sshd.enable = true;
    sshd.publish = true;
  };

  services.nginx.virtualHosts."kleidi.ca" = {
    acmeRoot = null;
    useACMEHost = "kleidi.ca";
    addSSL = true;
    root = pkgs.depot.web.site;
  };

  security.acme = {
    acceptTerms = true;

    defaults = {
      email = "certs@4kb.net";
      dnsProvider = "porkbun";
      environmentFile = "/persist/porkbun";
      group = config.services.nginx.group;
    };

    certs."kleidi.ca".extraDomainNames = [ "*.kleidi.ca" ];
    certs."4kb.net".extraDomainNames = [ "*.4kb.net" ];
  };

  services.redlib.enable = true;
  services.nginx.virtualHosts."redlib.4kb.net" = {
    acmeRoot = null;
    useACMEHost = "4kb.net";
    forceSSL = true;
    locations."/" = {
      extraConfig = "proxy_http_version 1.1;";
      proxyPass = "http://${config.services.redlib.address}:${toString config.services.redlib.port}";
    };
  };

  xnet = {
    disk = {
      enable = true;
      device = "/dev/nvme0n1";
    };
    nginx.enable = true;
    gitServer = {
      enable = true;
      gitweb.enable = true;
    };
  };
}