diff options
author | sefidel <contact@sefidel.net> | 2023-02-06 18:08:33 +0900 |
---|---|---|
committer | sefidel <contact@sefidel.net> | 2023-02-06 18:08:33 +0900 |
commit | 2788edf8f6ddc0a5ccd141db51321cd21abb5adf (patch) | |
tree | cbca719739f3eeef32dd47cb9d0fa823f09c4915 /nixos/cobalt/services/cgit.nix | |
parent | bdf36408a71b1b3993a9552637d86495cb677b86 (diff) | |
download | nixrc-2788edf8f6ddc0a5ccd141db51321cd21abb5adf.tar.gz nixrc-2788edf8f6ddc0a5ccd141db51321cd21abb5adf.zip |
feat: merge colmena to nixos
Diffstat (limited to 'nixos/cobalt/services/cgit.nix')
-rw-r--r-- | nixos/cobalt/services/cgit.nix | 105 |
1 files changed, 105 insertions, 0 deletions
diff --git a/nixos/cobalt/services/cgit.nix b/nixos/cobalt/services/cgit.nix new file mode 100644 index 0000000..4e030c8 --- /dev/null +++ b/nixos/cobalt/services/cgit.nix @@ -0,0 +1,105 @@ +{ pkgs, ... }: + +{ + services.uwsgi = { + enable = true; + user = "nginx"; + group = "nginx"; + plugins = [ "cgi" ]; + + instance = { + type = "emperor"; + vassals = { + cgit = { + type = "normal"; + master = true; + socket = "/run/uwsgi/cgit.sock"; + procname-master = "uwsgi cgit"; + plugins = [ "cgi" ]; + cgi = "${pkgs.cgit-pink}/cgit/cgit.cgi"; + }; + }; + }; + }; + + users.extraUsers.nginx.extraGroups = [ "git" ]; + + services.nginx.virtualHosts."git.sefidel.com" = { + addSSL = true; + useACMEHost = "sefidel.com"; + root = "${pkgs.cgit-pink}/cgit"; + locations = { + "/" = { + extraConfig = '' + try_files $uri @cgit; + ''; + }; + "@cgit" = { + extraConfig = '' + uwsgi_pass unix:/run/uwsgi/cgit.sock; + include ${pkgs.nginx}/conf/uwsgi_params; + uwsgi_modifier1 9; + ''; + }; + }; + }; + + networking.firewall.allowedTCPPorts = [ 80 443 ]; + + systemd.services.create-cgit-cache = { + description = "Create cache directory for cgit"; + enable = true; + + script = '' + mkdir -p /run/cgit + chown -R nginx:nginx /run/cgit + ''; + + wantedBy = [ "uwsgi.service" ]; + serviceConfig = { + Type = "oneshot"; + }; + }; + + environment.etc."cgitrc".text = '' + virtual-root=/ + + cache-size=1000 + cache-root=/run/cgit + + root-title=sefidel git + root-desc=Exotic place. + + snapshots=tar.gz zip + + enable-git-config=1 + remove-suffix=1 + + enable-git-clone=1 + enable-index-links=1 + enable-commit-graph=1 + enable-log-filecount=1 + enable-log-linecount=1 + + branch-sort=age + + readme=:README + readme=:readme + readme=:README.md + readme=:readme.md + readme=:README.org + readme=:readme.org + + source-filter=${pkgs.cgit-pink}/lib/cgit/filters/syntax-highlighting.py + about-filter=${pkgs.cgit-pink}/lib/cgit/filters/about-formatting.sh + + section-from-path=2 + + project-list=/var/lib/gitolite/projects.list + scan-path=/var/lib/gitolite/repositories + ''; + + imports = [ + ./nginx.nix + ]; +} |