summaryrefslogtreecommitdiff
path: root/modules/git/cgit.nix
blob: a95868392417b04766d6db190462ee34aa46fa43 (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
{ config, pkgs, ... }:

let
  repositoryPath = "/home/compromyse";
in {
  services.cgit."localhost" = {
    enable = true;
    scanPath = repositoryPath;
    settings = {
      root-title = "compromyse: CGIT";
      root-desc = "Compromyse's Git Repositories";
      clone-url = "https://git.compromyse.xyz/$CGIT_REPO_URL";
      enable-commit-graph = 1;
      enable-log-filecount = 1;
      enable-log-linecount = 1;
    };
  };

  services.h2o = {
    enable = true;
    extraConfig = ''
      listen:
        port: 80
        host: 0.0.0.0
      listen:
        port: 443
        host: 0.0.0.0
        ssl:
          certificate-file: /var/lib/acme/git.compromyse.xyz/fullchain.pem
          key-file: /var/lib/acme/git.compromyse.xyz/key.pem

      # Default host configuration
      hosts:
        "*":
          paths:
            "/static/":
              file.dir: ${pkgs.cgit}/cgit

            "/":
              fastcgi.connect:
                unix: /run/cgit.sock
              fastcgi.spawn: "no"
              fastcgi.params:
                SCRIPT_FILENAME: ${pkgs.cgit}/cgit/cgit.cgi
                PATH_INFO: "index.html"

          access-log: /var/log/h2o/git-access.log
          error-log: /var/log/h2o/git-error.log
    '';
  };

  security.acme = {
    acceptTerms = true;
    defaults.email = "raghus2247@gmail.com";
    certs."git.compromyse.xyz".webroot = "/var/lib/acme/acme-challenge";
  };
}