diff options
Diffstat (limited to 'modules/services/gitolite')
-rw-r--r-- | modules/services/gitolite/default.nix | 37 |
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 ]; }; + }; +} |