From ce06f43476863da90dc60dcee606d2b6c5a89a8e Mon Sep 17 00:00:00 2001 From: sefidel Date: Wed, 29 Mar 2023 20:54:19 +0900 Subject: project: initial commit --- modules/services/sefidel-web.nix | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 modules/services/sefidel-web.nix (limited to 'modules/services/sefidel-web.nix') diff --git a/modules/services/sefidel-web.nix b/modules/services/sefidel-web.nix new file mode 100644 index 0000000..fdbcb00 --- /dev/null +++ b/modules/services/sefidel-web.nix @@ -0,0 +1,26 @@ +{ inputs, config, lib, ... }: + +with lib; +let + cfg = config.modules.services.sefidel-web; +in +{ + options.modules.services.sefidel-web = { + enable = mkEnableOption "sefidel-web"; + }; + + config = mkIf cfg.enable { + services.nginx.virtualHosts."sefidel.net" = { + useACMEHost = "sefidel.net"; + forceSSL = true; + # TODO: causes css to be fetched every single time. + # This is because heuristic caching is disabled, since Nix removes the last-modified timestamp. + root = inputs.sefidel-web.defaultPackage.${config.nixpkgs.system}; + + # Fixes the problem above. + locations."~ \\.(js|css|woff|woff2?|png|jpe?g|svg)$".extraConfig = '' + add_header Cache-Control "public, max-age=14400, must-revalidate"; + ''; + }; + }; +} -- cgit 1.4.1