{ pkgs, config, ... }: { config = { users.groups.git = {}; users.users.git = { isSystemUser = true; description = "tzlil"; group = "git"; home = "/home/git"; packages = [pkgs.git]; shell = "${pkgs.git}/bin/git-shell"; openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMDyzrs9sbstv3KFK5FV8qYlSknnEy8Cn+qch4dJLmHA" ]; }; # for syntax highlighting users.groups.fcgiwrap = {}; users.users.fcgiwrap = { isSystemUser = true; group = "fcgiwrap"; packages = [pkgs.highlight pkgs.fcgiwrap]; }; services = { fcgiwrap = { enable = true; user = "fcgiwrap"; group = "fcgiwrap"; }; caddy = { virtualHosts."http://git.95.179.168.209.vultrusercontent.com".extraConfig = '' bind 0.0.0.0 ${config.website.defaultHeaders} header -Server handle /cgit.png { root * ${pkgs.cgit}/cgit file_server } handle /cgit.css { root * ${pkgs.cgit}/cgit file_server } handle /favicon.ico { root * ${pkgs.cgit}/cgit file_server } handle { reverse_proxy unix//run/fcgiwrap.sock { transport fastcgi { env SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi env CGIT_CONFIG ${pkgs.writeText "cgitrc" (pkgs.lib.generators.toKeyValue {} { css = "/cgit.css"; logo = "/cgit.png"; favicon = "/favicon.ico"; clone-url = pkgs.lib.concatStringsSep " " [ "http://$HTTP_HOST$SCRIPT_NAME/$CGIT_REPO_URL" "ssh://git@git.example.com:$CGIT_REPO_URL" ]; enable-log-filecount = 1; enable-log-linecount = 1; enable-git-config = 1; root-title = "git.example.com"; root-desc = "Tzlil's Git Repositories"; scan-path = "/home/git"; about-filter = "${pkgs.cgit}/lib/cgit/filters/about-formatting.py"; source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py"; logo-link = "/"; })} } } } ''; }; }; environment.persistence."/nix/persist".directories = [ { directory = "/home/git"; user = "git"; group = "git"; } ]; }; }