{ pkgs, ...}: let cgitHostname = "git.niedzwiedzinski.cyou"; mirror = pkgs.writeScriptBin "mirror" '' #!/bin/sh name=`echo "$1" | rev | cut -d'/' -f1 | rev` cd /srv/git sudo -u git ${pkgs.git}/bin/git clone --mirror $1 $name sudo -u git /run/current-system/sw/bin/chmod -R g+w $name ''; newrepo = pkgs.writeScriptBin "newrepo" '' #!/bin/sh [ -z $1 ] && echo "Pass repo name" && exit 1 sudo -u git git init --bare /srv/git/$1 sudo -u git /run/current-system/sw/bin/chmod -R g+w /srv/git/$1 ''; in { environment.systemPackages = [ newrepo mirror ]; systemd.services.git-fetch = { script = '' #!/bin/sh cd /srv/git for f in `find . -name HEAD`; do cd ''${f%HEAD} ${pkgs.git}/bin/git fetch cd /srv/git done ''; serviceConfig = { Type = "oneshot"; User = "git"; }; }; systemd.timers.git-fetch = { partOf = [ "git-fetch.service" ]; wantedBy = ["timers.target" ]; timerConfig = { OnCalendar = "hourly"; Unit = "git-fetch.service"; }; }; services.nginx.virtualHosts."${cgitHostname}" = { locations."=/mylogo.png" = { alias = "${./baby-yoda.png.comp}"; }; forceSSL = true; enableACME = true; }; services.cgit.gitN = { enable = true; user = "cgit"; package = pkgs.cgit-pink; scanPath = "/srv/git"; nginx.virtualHost = cgitHostname; settings = { about-filter = let formatScript = pkgs.writeScriptBin "about-format.sh" '' #!/bin/sh ${pkgs.coreutils}/bin/cat << EOF