diff options
author | Linnnus <[email protected]> | 2023-10-03 19:24:59 +0200 |
---|---|---|
committer | Linnnus <[email protected]> | 2023-10-08 13:14:15 +0200 |
commit | c475c0077764acea6f12b88b24d20b7b2720cd5c (patch) | |
tree | 6f0fb4d9a16dd792762d5884d99e8696617de6ce /modules/nixos/nofitications.linus.onl | |
parent | c868c8a61fd3b9a4b404001aba0c4c6b7318a4a3 (diff) |
Move personal modules hosts/ahmed -> modules/nixos/
Diffstat (limited to 'modules/nixos/nofitications.linus.onl')
-rw-r--r-- | modules/nixos/nofitications.linus.onl/default.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/nixos/nofitications.linus.onl/default.nix b/modules/nixos/nofitications.linus.onl/default.nix new file mode 100644 index 0000000..d77a0e7 --- /dev/null +++ b/modules/nixos/nofitications.linus.onl/default.nix @@ -0,0 +1,44 @@ +{ + 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.modules."notifications.linus.onl"; +in { + options.modules."notifications.linus.onl" = { + enable = mkEnableOption "notifications.linus.onl static site"; + + useACME = mkEnableOption "built-in HTTPS stuff"; + }; + + config = mkIf cfg.enable { + 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}"; + }; + }; + }; +} |