diff options
author | Minijackson <minijackson@riseup.net> | 2021-05-30 16:30:11 +0200 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2021-05-30 16:30:11 +0200 |
commit | 1f2adf6ba58c4cbcb47a3e6eff7c8001f40cbadd (patch) | |
tree | 060353d5c192feae4b80ccc1fc9d77c49b3d5e14 /usecases/server | |
parent | bdb24fdbb21bf93b70a09734c60a8071c397da84 (diff) | |
download | nixos-config-reborn-1f2adf6ba58c4cbcb47a3e6eff7c8001f40cbadd.tar.gz nixos-config-reborn-1f2adf6ba58c4cbcb47a3e6eff7c8001f40cbadd.zip |
gotify-server: init
Diffstat (limited to 'usecases/server')
-rw-r--r-- | usecases/server/gotify-server.nix | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/usecases/server/gotify-server.nix b/usecases/server/gotify-server.nix new file mode 100644 index 0000000..5445827 --- /dev/null +++ b/usecases/server/gotify-server.nix | |||
@@ -0,0 +1,46 @@ | |||
1 | inputs: | ||
2 | |||
3 | { config, ... }: | ||
4 | |||
5 | { | ||
6 | services.gotify = { | ||
7 | enable = true; | ||
8 | port = 8082; | ||
9 | }; | ||
10 | |||
11 | # TODO: add proper boot notification | ||
12 | |||
13 | /* | ||
14 | systemd.services.gotify-notify-boot = { | ||
15 | after = [ "gotify-server.service" ]; | ||
16 | wantedBy = [ "multi-user.target" ]; | ||
17 | |||
18 | restartIfChanged = false; | ||
19 | |||
20 | serviceConfig = { | ||
21 | Type = "oneshot"; | ||
22 | |||
23 | # Priority is needed because there is no configuration, hence no default | ||
24 | # priority to fallback to | ||
25 | ExecStart = let params = lib.cli.toGNUCommandLineShell { } { | ||
26 | url = "http://localhost:${toString config.services.gotify.port}"; | ||
27 | token = "$GOTIFY_TOKEN"; | ||
28 | priority = 0; | ||
29 | }; | ||
30 | in "${pkgs.gotify-cli}/bin/gotify push ${params} 'The system has booted'"; | ||
31 | |||
32 | RemainAfterExit = "yes"; | ||
33 | # Adds lots of security options | ||
34 | DynamicUser = "yes"; | ||
35 | EnvironmentFile = "/etc/nixos/res/gotify-config.env"; | ||
36 | |||
37 | Restart = "on-failure"; | ||
38 | RestartSec = "3s"; | ||
39 | }; | ||
40 | }; | ||
41 | */ | ||
42 | |||
43 | networking.firewall.interfaces.${config.topology.mainVpn.interfaceName}.allowedTCPPorts = [ | ||
44 | config.services.gotify.port | ||
45 | ]; | ||
46 | } | ||