summaryrefslogtreecommitdiff
path: root/nix/modules/cgit.nix
blob: 5bf888d9c31b9cbaeb4fed9a2b835c7eed7bc17a (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
{ lib, config, ... }:
let
  serverName = "git.${config.monorepo.vars.orgHost}";
in
{
  services.cgit."my-projects" = {
    enable = lib.mkDefault config.services.gitDaemon.enable;
    scanPath = "${config.users.users.git.home}";
    settings = {
      root-title = "Nullring Git Server";
      root-desc = "Projects and cool things";
      enable-commit-graph = 1;
      enable-log-filecount = 1;
      enable-log-linecount = 1;
      enable-index-owner = 0;
      clone-prefix = "https://${serverName}";
      enable-tree-linenumbers = 1;
      strict-export = "git-daemon-export-ok";
    };
    gitHttpBackend = {
      enable = true;
      checkExportOkFiles = true;
    };
    nginx = {
      virtualHost = "${serverName}";
    };
  };

  networking.domains.subDomains."${serverName}" = lib.mkIf config.services.cgit."my-projects".enable { };
  services.nginx.virtualHosts."${serverName}" = lib.mkIf config.services.cgit."my-projects".enable {
    forceSSL = true;
    enableACME = true;
  };
}