summaryrefslogtreecommitdiffstats
path: root/modules/nginx.nix
blob: 8b420613b77d3a1cc5a2b31ab7c9b367fb6fd583 (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
27
28
29
30
{ config, pkgs, ... }:

{
  services.nginx =
    let
      name = config.networking.hostName;
      qname = "${name}.retiolum";
    in
      {
        enable = true;
        httpConfig = ''
          sendfile  on;
          server {
            listen      80;
            server_name ${name} ${qname} localhost;
            root /srv/http/${name};
            location ~ ^/~(.+?)(/.*)?$ {
              alias /home/$1/public_html$2;
            }
          }
          types {
            text/css css;
            text/html html;
            image/svg+xml svg;
          }
          default_type text/html;
          charset utf-8;
        '';
      };
}