summaryrefslogtreecommitdiff
path: root/modules/nixos/cgit.nix
blob: a260c871fde96a66727f42621d8860c465dd63b4 (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
{ config, pkgs, ... } : 
let
  domain = "myrmexia.xyz";
  subDomain = "git.${domain}";
  email = "devin.finlinson@pm.me";
in { # This is for hosting on bosco
  services.cgit = {
    "${subDomain}" = {
      user = "cgit";
      enable = true;
      settings = {
        enable-commit-graph = 1;
        enable-http-clone = 0;
        source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py";
      };
      repos = {
        nixos-flake = {
          desc = "A public repo for viewing my nixos config.";
          path = "/srv/git/.flake.git";
        };
      };
    };
  };
  services.nginx.virtualHosts."${subDomain}".listen = [
    # port = 8081;
  # };
    { 
      addr = "localhost";
      port = 8081;
    }
    # listen.port = 8081;
  ];

  # this solution is extremely hacky as it changes nginx system defaults instead of virtual host default
  #TODO: fix
  # services.nginx.defaultHTTPListenPort = 8081;
  services.caddy = {
      enable = true;
      email = "${email}";
      virtualHosts."git.myrmexia.xyz".extraConfig = ''
        reverse_proxy http://localhost:8081
      '';
  #       # reverse_proxy http://localhost:${toString config.services.cgit.port} ''
    };
  # networking.firewall.allowedTCPPorts = [8081]; 
}