From 1f2adf6ba58c4cbcb47a3e6eff7c8001f40cbadd Mon Sep 17 00:00:00 2001 From: Minijackson Date: Sun, 30 May 2021 16:30:11 +0200 Subject: gotify-server: init --- usecases/server/gotify-server.nix | 46 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 usecases/server/gotify-server.nix (limited to 'usecases/server') 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 @@ +inputs: + +{ config, ... }: + +{ + services.gotify = { + enable = true; + port = 8082; + }; + + # TODO: add proper boot notification + + /* + systemd.services.gotify-notify-boot = { + after = [ "gotify-server.service" ]; + wantedBy = [ "multi-user.target" ]; + + restartIfChanged = false; + + serviceConfig = { + Type = "oneshot"; + + # Priority is needed because there is no configuration, hence no default + # priority to fallback to + ExecStart = let params = lib.cli.toGNUCommandLineShell { } { + url = "http://localhost:${toString config.services.gotify.port}"; + token = "$GOTIFY_TOKEN"; + priority = 0; + }; + in "${pkgs.gotify-cli}/bin/gotify push ${params} 'The system has booted'"; + + RemainAfterExit = "yes"; + # Adds lots of security options + DynamicUser = "yes"; + EnvironmentFile = "/etc/nixos/res/gotify-config.env"; + + Restart = "on-failure"; + RestartSec = "3s"; + }; + }; + */ + + networking.firewall.interfaces.${config.topology.mainVpn.interfaceName}.allowedTCPPorts = [ + config.services.gotify.port + ]; +} -- cgit v1.2.3