diff options
Diffstat (limited to 'services/push-notification-api/default.nix')
-rw-r--r-- | services/push-notification-api/default.nix | 67 |
1 files changed, 0 insertions, 67 deletions
diff --git a/services/push-notification-api/default.nix b/services/push-notification-api/default.nix deleted file mode 100644 index 1897cd1..0000000 --- a/services/push-notification-api/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -# Temporary definition for push-notification-api service. This will be moved -# into the flake once it's finished. - -{ pkgs, lib, config, flakeInputs, ... }: - -let - inherit (lib) mkEnableOption mkOption mkIf types; - cfg = config.my.services.push-notification-api; -in -{ - options.my.services.push-notification-api = { - enable = mkEnableOption "Push notification API"; - - package = mkOption { - description = "What package to use."; - default = flakeInputs.push-notification-api.packages.${pkgs.system}.default; - type = types.package; - }; - - host = mkOption { - description = "Host(name) to passed to server"; - type = types.nonEmptyStr; - default = "0.0.0.0"; - }; - - port = mkOption { - description = "Port to listen for requests on"; - type = types.port; - default = 8000; - }; - - openFirewall = mkEnableOption "Poke holes in the firewall to permit LAN connections."; - }; - - config = mkIf cfg.enable { - # Create a user to run the server under. - users.users.push-notification-api = { - description = "Runs daily dukse reminder"; - group = "push-notification-api"; - isSystemUser = true; - home = "/srv/push-notification-api"; - createHome = true; - }; - users.groups.push-notification-api = { }; - - # Create a service which runs the server. - systemd.services.push-notification-api = { - wantedBy = [ "multi-user.target" ]; - after = [ "network.target" "netowrk-online.target" ]; - wants = [ "network.target" ]; - - serviceConfig = { - Type = "simple"; - User = config.users.users.push-notification-api.name; - Group = config.users.users.push-notification-api.group; - WorkingDirectory = config.users.users.push-notification-api.home; - ExecStart = '' - "${cfg.package}"/bin/push-notification-api --port ${toString cfg.port} --host "${cfg.host}" - ''; - }; - }; - - networking.firewall = mkIf cfg.openFirewall { - allowedTCPPorts = [ cfg.port ]; - }; - }; -} |