about summary refs log tree commit diff
path: root/modules/services/sefidel-web.nix
blob: fdbcb00b9d18e74e328e9e62ea8c85f071421a14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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";
      '';
    };
  };
}