diff options
author | Azat Bahawi <azat@bahawi.net> | 2024-07-29 13:21:02 +0300 |
---|---|---|
committer | Azat Bahawi <azat@bahawi.net> | 2024-07-29 13:21:02 +0300 |
commit | 40e1c1da0ab384440043424a1988f8d7f57cf879 (patch) | |
tree | 83bfdd90603d73770c0e5e772ccf617f8e15ecec /modules/git | |
parent | 2024-07-29 (diff) |
2024-07-29
Diffstat (limited to '')
-rw-r--r-- | modules/git/default.nix | 63 |
1 files changed, 45 insertions, 18 deletions
diff --git a/modules/git/default.nix b/modules/git/default.nix index 909bc2b..eb0021d 100644 --- a/modules/git/default.nix +++ b/modules/git/default.nix @@ -195,21 +195,18 @@ in # FIXME Plausible, go-import, custom favicon, etc. nixfiles.modules.nginx = { enable = true; - virtualHosts.${domain}.locations = { - "/".extraConfig = mkOrder 5000 '' - ${libNginx.config.appendHead [ - ''<meta name="go-import" content="$host$uri git https://$host$uri">'' - (libPlausible.htmlPlausibleScript { inherit (cfg.server) domain; }) - ]} - ''; - }; + virtualHosts.${domain}.locations = { }; }; services = { cgit.${domain} = { enable = true; + + # We make gitolite repos readable by the common group. group = "git"; + scanPath = "${config.services.gitolite.dataDir}/repositories"; + settings = { root-title = "cgit"; root-desc = "https://github.com/azahi"; @@ -223,17 +220,9 @@ in enable-git-config = true; enable-gitweb-owner = true; remove-suffix = true; + + logo = "/logo.gif"; }; - extraConfig = '' - readme=:README - readme=:README.md - readme=:README.org - readme=:README.txt - readme=:readme - readme=:readme.md - readme=:readme.org - readme=:readme.txt - ''; }; gitolite = { @@ -252,6 +241,44 @@ in $RC{GIT_CONFIG_KEYS} = '.*'; ''; }; + + nginx.virtualHosts.${domain}.locations = + let + extraHead = '' + ${libNginx.config.appendHead [ + ''<meta name="go-import" content="$host$uri git https://$host$uri">'' + (libPlausible.htmlPlausibleScript { inherit (cfg.server) domain; }) + ]} + ''; + in + { + "/" = { + extraConfig = mkBefore extraHead; + fastcgiParams.HTTP_ACCEPT_ENCODING = ""; + }; + "~ /.+/(info/refs|git-upload-pack)" = { + extraConfig = mkBefore extraHead; + fastcgiParams.HTTP_ACCEPT_ENCODING = ""; + }; + "= /logo.gif".alias = "${./logo.gif}"; + "= /favicon.ico" = { + alias = "${./favicon.ico}"; + extraConfig = mkForce ""; + }; + "= /cgit.css" = { + alias = pkgs.writeText "cgit.css" '' + ${readFile "${package}/cgit/cgit.css"} + div#cgit { + font-family: ${ + concatMapStringsSep ", " (f: ''"${f}"'') config.fonts.fontconfig.defaultFonts.monospace + }, monospace !important; + -moz-tab-size: 2 !important; + tab-size: 2 !important; + } + ''; + extraConfig = mkForce ""; + }; + }; }; } )) |