blob: da83f73d30a1a0cf6a522fe9353a04dbb09ed323 (
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
|
{ config, lib, pkgs, ... }:
let
cfg = config.xnet.gitServer;
inherit (lib) mkOption mkIf types;
in
{
imports = [ ./gitweb.nix ];
options.xnet.gitServer = {
enable = mkOption {
type = types.bool;
default = false;
description = "Serve git repos over SSH.";
};
path = mkOption {
type = types.path;
default = "/persist/repo/git";
description = "Directory where repos will be stored.";
};
keys = mkOption {
type = types.listOf types.str;
description = "SSH public keys used for git operations.";
};
};
config = mkIf cfg.enable {
users.users.git = {
group = "git";
initialPassword = "";
isSystemUser = true;
home = cfg.path;
homeMode = "755";
createHome = true;
shell = "${pkgs.git}/bin/git-shell";
openssh.authorizedKeys.keys = cfg.keys;
};
users.groups.git = { };
programs.git = {
enable = true;
config = {
init = {
defaultBranch = "master";
};
safe = {
directory = "*";
};
};
};
};
}
|