-
Notifications
You must be signed in to change notification settings - Fork 0
/
gogs.nix
52 lines (51 loc) · 1.47 KB
/
gogs.nix
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
{ config, pkgs, lib, ... }:
let
cfg = config.services.yorick.gogs;
in
{
options.services.yorick.gogs = with lib; {
enable = mkEnableOption "gogs";
dir = mkOption { type = types.string; default = "/var/gogs"; };
port = mkOption { type = types.int; default = 8001; };
vhost = mkOption { type = types.string; };
};
config = lib.mkIf cfg.enable {
users.extraUsers.git = { home = cfg.dir; extraGroups = [ "git" ]; useDefaultShell = true;};
users.extraGroups.git = { };
services.gogs = rec {
enable = true;
user = "git";
group = "git";
database.user = "root";
stateDir = cfg.dir;
repositoryRoot = "${stateDir}/gogs-repositories";
rootUrl = "https://${cfg.vhost}/";
httpAddress = "localhost";
httpPort = cfg.port;
extraConfig = ''
[service]
REGISTER_EMAIL_CONFIRM = false
ENABLE_NOTIFY_MAIL = false
DISABLE_REGISTRATION = true
REQUIRE_SIGNIN_VIEW = false
[picture]
DISABLE_GRAVATAR = false
AVATAR_UPLOAD_PATH = ${cfg.dir}/data/avatars
[mailer]
ENABLED = false
'';
domain = cfg.vhost;
};
users.extraUsers.gogs.createHome = lib.mkForce false;
services.nginx.virtualHosts.${cfg.vhost} = {
forceSSL = true;
enableACME = true;
locations."/" = {
proxyPass = "http://127.0.0.1:${toString cfg.port}";
extraConfig = ''
proxy_buffering off;
'';
};
};
};
}