about summary refs log tree commit diff
path: root/modules/nixos/git
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
committerAzat Bahawi <azat@bahawi.net>2024-04-21 02:15:42 +0300
commite6ed60548397627bf10f561f9438201dbba0a36e (patch)
treef9a84c5957d2cc4fcd148065ee9365a0c851ae1c /modules/nixos/git
parent2024-04-18 (diff)
2024-04-21
Diffstat (limited to '')
-rw-r--r--modules/git/favicon.ico (renamed from modules/nixos/git/favicon.ico)bin15406 -> 15406 bytes
-rw-r--r--modules/git/logo.gif (renamed from modules/nixos/git/logo.gif)bin138553 -> 138553 bytes
-rw-r--r--modules/nixos/git/default.nix136
3 files changed, 0 insertions, 136 deletions
diff --git a/modules/nixos/git/favicon.ico b/modules/git/favicon.ico
index bb7cc39..bb7cc39 100644
--- a/modules/nixos/git/favicon.ico
+++ b/modules/git/favicon.ico
Binary files differdiff --git a/modules/nixos/git/logo.gif b/modules/git/logo.gif
index 05874f9..05874f9 100644
--- a/modules/nixos/git/logo.gif
+++ b/modules/git/logo.gif
Binary files differdiff --git a/modules/nixos/git/default.nix b/modules/nixos/git/default.nix
deleted file mode 100644
index 34ca200..0000000
--- a/modules/nixos/git/default.nix
+++ /dev/null
@@ -1,136 +0,0 @@
-{
-  config,
-  lib,
-  libNginx,
-  libPlausible,
-  pkgs,
-  ...
-}:
-with lib;
-let
-  cfg = config.nixfiles.modules.git;
-in
-{
-  options.nixfiles.modules.git.server = {
-    enable = mkEnableOption "Git server";
-
-    domain = mkOption {
-      description = "Domain name sans protocol scheme.";
-      type = with types; nullOr str;
-      default = "git.${config.networking.domain}";
-    };
-
-    package = mkOption {
-      description = "Package.";
-      type = types.package;
-      default = pkgs.cgit;
-    };
-  };
-
-  config = mkIf cfg.server.enable {
-    ark.directories = [ config.services.gitolite.dataDir ];
-
-    nixfiles.modules.nginx = {
-      enable = true;
-      virtualHosts.${cfg.server.domain} = {
-        locations = {
-          "/".extraConfig =
-            let
-              cgitrc = pkgs.writeText "cgitrc" ''
-                root-title=github sux (⩺_⩹)
-                root-desc=https://github.com/azahi
-
-                clone-url=https://${cfg.server.domain}/$CGIT_REPO_URL
-
-                logo=/cgit-custom-logo.gif
-                favicon=/cgit-custom-favicon.gif
-                css=/cgit-custom-style.css
-
-                about-filter=${cfg.server.package}/lib/cgit/filters/about-formatting.sh
-                source-filter=${cfg.server.package}/lib/cgit/filters/syntax-highlighting.py
-                commit-filter=${cfg.server.package}/lib/cgit/filters/commit-links.sh
-
-                enable-git-config=1
-                enable-gitweb-owner=1
-                remove-suffix=1
-
-                readme=:README
-                readme=:README.md
-                readme=:README.org
-                readme=:README.txt
-                readme=:readme
-                readme=:readme.md
-                readme=:readme.org
-                readme=:readme.txt
-
-                scan-path=${config.services.gitolite.dataDir}/repositories
-              '';
-            in
-            ''
-              include ${config.services.nginx.package}/conf/fastcgi_params;
-              fastcgi_split_path_info ^(/?)(.+)$;
-              fastcgi_pass unix:${config.services.fcgiwrap.socketAddress};
-              fastcgi_param SCRIPT_FILENAME ${cfg.server.package}/cgit/cgit.cgi;
-              fastcgi_param CGIT_CONFIG ${cgitrc};
-              fastcgi_param PATH_INFO $uri;
-              fastcgi_param QUERY_STRING $args;
-              fastcgi_param HTTP_HOST $server_name;
-
-              ${libNginx.config.appendHead [
-                ''<meta name="go-import" content="$host$uri git https://$host$uri">''
-                (libPlausible.htmlPlausibleScript { inherit (cfg.server) domain; })
-              ]}
-            '';
-          "~* ^.+(cgit.css|robots.txt)$".extraConfig = ''
-            root ${cfg.server.package}/cgit;
-          '';
-          "~* ^.+cgit-custom-logo.gif$".extraConfig = ''
-            alias ${./logo.gif};
-          '';
-          "~* ^.+cgit-custom-favicon.gif$".extraConfig = ''
-            alias ${./favicon.ico};
-          '';
-          "~* ^.+cgit-custom-style.css$".extraConfig =
-            let
-              css = pkgs.writeText "custom.css" ''
-                @import url("cgit.css");
-
-                div#cgit {
-                  font-family: monospace;
-                  -moz-tab-size: 4;
-                  tab-size: 4;
-                }
-              '';
-            in
-            ''
-              alias ${css};
-            '';
-        };
-      };
-    };
-
-    services =
-      let
-        user = "git";
-        group = "git";
-      in
-      {
-        gitolite = {
-          enable = true;
-          inherit user group;
-          adminPubkey = my.ssh.key;
-          extraGitoliteRc = ''
-            # This allows hiding repositories via "cgit.ignore"[1].
-            #
-            # [1]: https://www.omarpolo.com/post/cgit-gitolite.html
-            $RC{GIT_CONFIG_KEYS} = '.*';
-          '';
-        };
-
-        fcgiwrap = {
-          enable = true;
-          inherit user group;
-        };
-      };
-  };
-}

Consider giving Nix/NixOS a try! <3