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

let
  repositoryPath = "/home/git";
  cgit = (pkgs.callPackage ../../packages/cgit.nix {
    dist = ./cgit-dist;
    theme = "monokai";
  });
in {
  services.cgit."git.compromyse.xyz" = {
    enable = true;
    user = "root";
    group = "root";

    package = cgit;

    scanPath = repositoryPath;
    settings = {
      root-title = "compromyse: CGIT";
      root-desc = "Compromyse's Git Repositories";

      repository-sort = "age";

      enable-commit-graph = true;
      enable-follow-links = true;
      section-from-path = true;

      source-filter = "${cgit}/lib/cgit/filters/syntax-highlighting.py";
      about-filter = "${cgit}/lib/cgit/filters/about-formatting.sh";

      head-include = "/config/modules/git/cgit-dist/cgit_theme.css";
      virtual-root = "/";
      clone-prefix = "https://git.compromyse.xyz";
      clone-url = "https://git.compromyse.xyz/$CGIT_REPO_URL";

      "mimetype.gif" = "image/gif";
      "mimetype.html" = "text/html";
      "mimetype.jpg" = "image/jpeg";
      "mimetype.jpeg" = "image/jpeg";
      "mimetype.pdf" = "application/pdf";
      "mimetype.png" = "image/png";
      "mimetype.svg" = "image/svg+xml";
    };
  };

  services.nginx.virtualHosts."git.compromyse.xyz" = {
    forceSSL = true;
    enableACME = true;
  };

  security.acme = {
    acceptTerms = true;
    defaults.email = "raghus2247@gmail.com";
  };
}