diff options
-rw-r--r-- | flake.nix | 2 | ||||
-rw-r--r-- | usecases/server/gotify-server.nix | 46 |
2 files changed, 48 insertions, 0 deletions
@@ -76,6 +76,7 @@ | |||
76 | ankisyncd = (import ./usecases/server/ankisyncd.nix inputs); | 76 | ankisyncd = (import ./usecases/server/ankisyncd.nix inputs); |
77 | audit = (import ./usecases/server/audit.nix inputs); | 77 | audit = (import ./usecases/server/audit.nix inputs); |
78 | fail2ban = (import ./usecases/server/fail2ban.nix inputs); | 78 | fail2ban = (import ./usecases/server/fail2ban.nix inputs); |
79 | gotify-server = (import ./usecases/server/gotify-server.nix inputs); | ||
79 | monitoringTarget = (import ./usecases/server/monitoring-target.nix inputs); | 80 | monitoringTarget = (import ./usecases/server/monitoring-target.nix inputs); |
80 | radicale = (import ./usecases/server/radicale.nix inputs); | 81 | radicale = (import ./usecases/server/radicale.nix inputs); |
81 | smartd = (import ./usecases/server/smartd.nix inputs); | 82 | smartd = (import ./usecases/server/smartd.nix inputs); |
@@ -169,6 +170,7 @@ | |||
169 | self.nixosModules.test | 170 | self.nixosModules.test |
170 | self.nixosModules.profiles.server | 171 | self.nixosModules.profiles.server |
171 | self.nixosModules.usecases.server.ankisyncd | 172 | self.nixosModules.usecases.server.ankisyncd |
173 | self.nixosModules.usecases.server.gotify-server | ||
172 | self.nixosModules.usecases.server.radicale | 174 | self.nixosModules.usecases.server.radicale |
173 | self.nixosModules.usecases.server.zfs | 175 | self.nixosModules.usecases.server.zfs |
174 | 176 | ||
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 | } | ||