diff options
author | Linnnus <[email protected]> | 2023-10-01 21:48:51 +0200 |
---|---|---|
committer | Linnnus <[email protected]> | 2023-10-01 21:48:51 +0200 |
commit | 6d22256a85df7228a356a802dbc513c8abeeb2b7 (patch) | |
tree | eddc506e9cb0aa49c79c261a2995dd8de41135b7 /hosts/ahmed/notifications.linus.onl.nix | |
parent | 877db4137c34216fc2623570bc155d73e4b27f0b (diff) |
Export modules
Diffstat (limited to 'hosts/ahmed/notifications.linus.onl.nix')
-rw-r--r-- | hosts/ahmed/notifications.linus.onl.nix | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/hosts/ahmed/notifications.linus.onl.nix b/hosts/ahmed/notifications.linus.onl.nix new file mode 100644 index 0000000..443853f --- /dev/null +++ b/hosts/ahmed/notifications.linus.onl.nix @@ -0,0 +1,42 @@ +{ pkgs, lib, config, ... }: + +let + inherit (lib) mkEnableOption mkOption types mkIf optional; + + domain = "notifications.linus.onl"; + + # TODO: Make option internal-port. + internal-port = 13082; + + cfg = config.my.modules."notifications.linus.onl"; +in +{ + options.my.modules."notifications.linus.onl" = { + enable = mkEnableOption "notifications.linus.onl static site"; + + useACME = mkEnableOption "built-in HTTPS stuff"; + }; + + config = mkIf cfg.enable { + my.services.push-notification-api = { + enable = true; + # host = "notifications.linus.onl"; + host = "0.0.0.0"; + port = internal-port; + openFirewall = false; # We're using NGINX reverse proxy. + }; + + # Register domain name. + services.cloudflare-dyndns.domains = [ "notifications.linus.onl" ]; + + # Serve the generated page using NGINX. + services.nginx.virtualHosts."notifications.linus.onl" = { + enableACME = cfg.useACME; + forceSSL = cfg.useACME; + locations."/" = { + recommendedProxySettings = true; + proxyPass = "http://127.0.0.1:${toString internal-port}"; + }; + }; + }; +} |