blob: 671b708fefb3c50f48ef84bb429b321d2269bb96 (
plain)
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
65
66
|
{
config,
inputs,
pkgs,
...
}:
let
domain = "git.kassouni.net";
repoRoot = "/srv/git";
theme = inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.cgit-theme;
in
{
users.users.git = {
isSystemUser = true;
group = "git";
home = repoRoot;
createHome = true;
homeMode = "750";
shell = "${pkgs.git}/bin/git-shell";
openssh.authorizedKeys.keys = config.my.gitKeys;
};
users.groups.git = { };
environment.systemPackages = [ pkgs.git ];
services.openssh.extraConfig = ''
Match user git
AllowTcpForwarding no
AllowAgentForwarding no
PermitTTY no
'';
services.cgit.${domain} = {
enable = true;
scanPath = repoRoot;
group = "git"; # so cgit can traverse a non-world-readable repoRoot
gitHttpBackend.checkExportOkFiles = true;
settings = {
root-title = "git.kassouni.net";
root-desc = "";
css = [ "/theme.css" ];
logo = "/git.svg";
favicon = "/git.svg";
strict-export = "git-daemon-export-ok";
remove-suffix = true;
readme = [
":README.md"
":README"
":readme.md"
];
clone-url = "git@${domain}:$CGIT_REPO_URL https://${domain}/$CGIT_REPO_URL";
source-filter = "${pkgs.cgit}/lib/cgit/filters/syntax-highlighting.py";
about-filter = "${pkgs.cgit}/lib/cgit/filters/about-formatting.sh";
};
};
services.nginx.virtualHosts.${domain} = {
forceSSL = true;
enableACME = true;
locations = {
"= /theme.css".alias = "${theme}/theme.css";
"/fonts/".alias = "${theme}/fonts/";
"= /git.svg".alias = ./git.svg;
};
};
}
|