about summary refs log tree commit diff
path: root/modules/services/gitolite
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2023-02-28 18:57:45 -0800
committerFranck Cuny <franck@fcuny.net>2023-03-02 19:38:56 -0800
commit202376c7a0f4804f31afce52b5c79a776340467d (patch)
treefbfcb042fdb9ce57b2903ad58cb59cd42732c53d /modules/services/gitolite
parentfix(home/age): use `rage' for `passage' (diff)
downloadworld-202376c7a0f4804f31afce52b5c79a776340467d.tar.gz
feat(hosts/tahoe): install gitolite and cgit
Replace gitea with gitolite + cgit. I don't need a whole git forge for
myself, especially since I don't use most of the features.

The main thing I'm losing with this change is CI (via drone), but this
is not really a big loss for now.
Diffstat (limited to 'modules/services/gitolite')
-rw-r--r--modules/services/gitolite/default.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/modules/services/gitolite/default.nix b/modules/services/gitolite/default.nix
new file mode 100644
index 0000000..1cfab29
--- /dev/null
+++ b/modules/services/gitolite/default.nix
@@ -0,0 +1,37 @@
+{ config, pkgs, lib, ... }:
+let cfg = config.my.services.gitolite;
+in
+{
+  options.my.services.gitolite = with lib; {
+    enable = mkEnableOption "gitolite";
+    stateDir = mkOption {
+      type = types.str;
+      example = "/var/lib/gitolite";
+      description = "gitolite base directory";
+    };
+  };
+
+  # FIXME: I also ran the following as the git user:
+  # git config --global init.defaultBranch main
+  # to ensure that new repositories are created with the default
+  # branch set to `main'.
+  config = lib.mkIf cfg.enable {
+    services.gitolite = {
+      enable = true;
+      dataDir = cfg.stateDir;
+      adminPubkey = "sk-ssh-ed25519@openssh.com AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29tAAAAIGX4+CuUjiX6Doi4n6RqmznzFUyRrxKhEFvuIxROzXDKAAAABHNzaDo=";
+      user = "git";
+      group = "git";
+      extraGitoliteRc = ''
+        # Make dirs/files group readable, needed for webserver/cgit. (Default
+        # setting is 0077.)
+        $RC{UMASK} = 0027;
+        $RC{GIT_CONFIG_KEYS} = 'cgit.desc cgit.hide cgit.ignore cgit.owner cgit.section';
+        $RC{LOCAL_CODE} = "$rc{GL_ADMIN_BASE}/local";
+        push( @{$RC{ENABLE}}, 'symbolic-ref' );
+      '';
+    };
+
+    my.services.backup = { paths = [ cfg.stateDir ]; };
+  };
+}