From ce831333a24011d0692f6871047fe74eab9fab8c Mon Sep 17 00:00:00 2001 From: "quentin@aristote.fr" Date: Sun, 29 Nov 2026 17:24:18 +0100 Subject: initial commit --- config/services/web/git/default.nix | 49 +++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 config/services/web/git/default.nix (limited to 'config/services/web/git/default.nix') diff --git a/config/services/web/git/default.nix b/config/services/web/git/default.nix new file mode 100644 index 0000000..5223927 --- /dev/null +++ b/config/services/web/git/default.nix @@ -0,0 +1,49 @@ +{ + config, + lib, + pkgs, + ... +}: + +let + scanPath = "/srv/git"; + gitconfig = '' + [safe] + directory = ${scanPath}/* + ''; +in +{ + services.cgit.default = { + enable = true; + inherit scanPath; + gitHttpBackend = { + enable = true; + checkExportOkFiles = false; + }; + nginx.virtualHost = "git"; + settings = { + head-include = "${./head.html}"; + root-title = "repositories"; + root-desc = "by Quentin Aristote"; + root-readme = "${./about.html}"; + source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py"; + clone-prefix = "https://git.aristote.fr"; + section-from-path = 1; + snapshots = "tar.gz tar.bz2 tar.xz"; # for nix support + enable-index-owner = 0; + }; + }; + + services.nginx.virtualHosts.git = { + serverName = "git.${config.networking.domain}"; + enableACME = true; + forceSSL = true; + locations."= /cgit.css".alias = lib.mkForce ./cgit.css; + }; + + # give access to the repos + users.users.cgit.extraGroups = [ "git" ]; + ## for the http backend + systemd.services.fcgiwrap-cgit-default.environment.XDG_CONFIG_HOME = + "${pkgs.writeTextDir "git/config" gitconfig}"; +} -- cgit v1.3.1