blob: 3ae8e73ab386a8e293c5e57b75d8bd3aecc3fbe6 (
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
{ config, pkgs, lib, ... }:
# cgit - fast web interface for git repositories.
#
# Repositories live in /srv/git/<repo>.git (bare repos).
# Access model:
# - Web browsing: public, no auth (https://git.karanj.com)
# - git clone/pull over HTTPS: public, read-only via git-http-backend
# - git push: SSH only, using the "git" user + your authorized keys
#
# Caddy routes:
# /git/* -> fcgiwrap serving git-http-backend (port 8085 via nginx shim)
# /* -> cgit (port 8086 via nginx shim)
#
# Both cgit and git-http-backend are served through a minimal nginx instance
# bound to localhost, which Caddy then reverse-proxies.
{
# Dedicated git user for SSH push access
users.users.git = {
isSystemUser = true;
group = "git";
home = "/srv/git";
shell = pkgs.git;
# Allow pushing from both your devices
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAwAgL0o4NVonSG07Xu4Eai84ns4AjoZj2V7dGC9nXit karanjayachandra@Einstein.local"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH+qnLTnorv+I2rSSfGjNiCuX/W5AxoNgAdu+cTOyKzW Galileo"
];
};
users.groups.git = {};
# Repository root
systemd.tmpfiles.rules = [
"d /srv/git 0755 git git -"
];
# cgit web interface served via nginx + fcgiwrap
services.cgit."git.karanj.com" = {
enable = true;
scanPath = "/srv/git";
settings = {
# Site branding
root-title = "karanj.com git";
root-desc = "personal git repositories";
# Enable common features
enable-index-links = 1;
enable-commit-graph = 1;
enable-log-filecount = 1;
enable-log-linecount = 1;
enable-blame = 1;
enable-http-clone = 1; # show clone URL in UI
# Public clone URL prefix shown in the cgit UI
clone-url = "https://git.karanj.com/$CGIT_REPO_URL";
# Syntax highlighting
source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py";
about-filter = "${pkgs.cgit}/lib/cgit/filters/about-formatting.sh";
};
};
}
|