From 28424ccb86f9fe02c9e9f95958cf10d3a9fe3777 Mon Sep 17 00:00:00 2001 From: Martin Fischer Date: Fri, 27 Dec 2024 13:16:07 +0100 Subject: refactor: split up tente/default.nix --- nixos/hosts/tente/git.nix | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 nixos/hosts/tente/git.nix (limited to 'nixos/hosts/tente/git.nix') diff --git a/nixos/hosts/tente/git.nix b/nixos/hosts/tente/git.nix new file mode 100644 index 0000000..0e005c7 --- /dev/null +++ b/nixos/hosts/tente/git.nix @@ -0,0 +1,55 @@ +{ config, lib, pkgs, ... }: + +let + cfg = config.git; +in +{ + options.git = { + webUiDomain = lib.mkOption { + type = lib.types.str; + }; + }; + + config = { + services = { + gitolite = { + enable = true; + adminPubkey = ""; # TODO: submit PR to nixpkgs to make this option optional + user = "git"; + group = "git"; + dataDir = "/srv/gitolite"; + extraGitoliteRc = '' + $RC{UMASK} = 0027; + $RC{GIT_CONFIG_KEYS} = 'cgit.* gitweb.*'; + + # not working for some reason? still getting `FATAL: git config 'gitweb.description' not allowed` if gitweb.* is omitted in GIT_CONFIG_KEYS + # push( @{$RC{ENABLE}}, 'cgit' ); # update description files instead of gitweb.description config + ''; + }; + + nginx.virtualHosts.${cfg.webUiDomain} = { + enableACME = true; + forceSSL = true; + }; + + cgit.main = { + enable = true; + # running as the gitolite user because otherwise cloning a repo via cgit fails with: + # fatal: detected dubious ownership in repository + user = config.services.gitolite.user; + group = config.services.gitolite.group; + nginx.virtualHost = cfg.webUiDomain; + scanPath = "${config.services.gitolite.dataDir}/repositories"; + settings = { + remove-suffix = 1; + enable-git-config = 1; + root-title = "push-f.com repositories"; + root-desc = "My various repositories."; + enable-index-owner = 0; + source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py"; + clone-prefix = "https://${cfg.webUiDomain}"; + }; + }; + }; + }; +} -- cgit v1.2.3