summaryrefslogtreecommitdiff
path: root/hosts/oixos/cgit.nix
diff options
context:
space:
mode:
authorbeeb5k <beebeeb5k@gmail.com>2026-09-02 19:12:59 +0530
committerbeeb5k <beebeeb5k@gmail.com>2026-09-02 19:12:59 +0530
commit3c4e1430be5eb53812a71e64b99d94adf7da8fbb (patch)
tree5e7676650fbd45182cc6c974fee38636ee4b7fbd /hosts/oixos/cgit.nix
parentc38acc6dce1075ae7e73dedf018be69202900054 (diff)
Diffstat (limited to 'hosts/oixos/cgit.nix')
-rw-r--r--hosts/oixos/cgit.nix67
1 files changed, 67 insertions, 0 deletions
diff --git a/hosts/oixos/cgit.nix b/hosts/oixos/cgit.nix
new file mode 100644
index 0000000..825f614
--- /dev/null
+++ b/hosts/oixos/cgit.nix
@@ -0,0 +1,67 @@
+{ pkgs, ... }:
+let
+ cgitPkg = pkgs.cgit;
+in
+{
+ users.groups.git = { };
+ users.users.git = {
+ isSystemUser = true;
+ group = "git";
+ home = "/var/lib/git";
+ createHome = true;
+ shell = "${pkgs.git}/bin/git-shell";
+ };
+
+ environment.etc."cgitrc".text = ''
+ root-title=beeb5k git repos
+ root-desc=Personal Code Repositories
+ scan-path=/var/lib/git
+ enable-http-clone=1
+ clone-prefix=https://git.beeb5k.space
+
+ css=/cgit-css/cgit.css
+ logo=/cgit-css/cgit.png
+ favicon=/favicon.ico
+
+ readme=:README.md
+ readme=:README.txt
+ readme=:README
+ '';
+
+ services.fcgiwrap.instances.cgit = {
+ process = {
+ user = "git";
+ group = "git";
+ };
+ socket = {
+ type = "unix";
+ address = "/run/fcgiwrap-cgit.sock";
+ user = "git";
+ group = "caddy";
+ mode = "0660";
+ };
+ };
+
+ services.caddy = {
+ enable = true;
+
+ virtualHosts."git.beeb5k.space".extraConfig = ''
+ # Article: location /cgit-css/ { alias /usr/share/cgit/; }
+ handle_path /cgit-css/* {
+ root * ${pkgs.cgit}/cgit
+ file_server
+ }
+
+ # Article: location / { fastcgi_pass ... fastcgi_param SCRIPT_FILENAME ... }
+ handle {
+ reverse_proxy unix//run/fcgiwrap-cgit.sock {
+ transport fastcgi {
+ env DOCUMENT_ROOT ${pkgs.cgit}/cgit
+ env SCRIPT_FILENAME ${pkgs.cgit}/cgit/cgit.cgi
+ env CGIT_CONFIG /etc/cgitrc
+ }
+ }
+ }
+ '';
+ };
+}