blob: bd3bf06c83cb8c5a2d1509b3ada802adef003ff9 (
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
|
# SPDX-FileCopyrightText: V <v@unfathomable.blue>
# SPDX-License-Identifier: OSL-3.0
{ pkgs, ... }:
let
socket = "/run/naut/naut.sock";
proxySocket = "/run/naut/naut-proxy.sock";
config = {
"#unfathomable" = [ "nixos-config" ];
"#ripple" = [ "ripple" "ripple-website" ];
};
in {
systemd.sockets.naut-proxy = {
wantedBy = [ "sockets.target" ];
listenStreams = [ proxySocket ];
socketConfig.SocketUser = "git";
};
systemd.services.naut-proxy = {
requires = [ "naut-proxy.socket" ];
serviceConfig.ExecStart = "${pkgs.systemd}/lib/systemd/systemd-socket-proxyd ${socket}";
};
systemd.services.naut = {
wantedBy = [ "multi-user.target" ];
environment.NAUT_SOCK = socket;
environment.NAUT_CONFIG = (pkgs.formats.toml {}).generate "naut.toml" config;
serviceConfig = {
ExecStart = "${pkgs.naut}/bin/naut";
EnvironmentFile = "/etc/naut/env";
Restart = "on-failure";
DynamicUser = true;
SupplementaryGroups = [ "git" ];
RuntimeDirectory = "naut";
};
};
declarative.git.hooks.post-receive = [
(pkgs.writeShellScript "nautify" ''
{
pwd
cat
} | nc -UN ${proxySocket}
'')
];
}
|