about summary refs log tree commit diff
path: root/modules/services/gitolite/default.nix
blob: 1cfab29e64110ad90cb2b090212bd02baae43dd7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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 ]; };
  };
}