-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule.nix
49 lines (44 loc) · 1.15 KB
/
module.nix
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
webapp:
{ config, lib, pkgs, ... }:
let
cfg = config.services.mappingmigration;
in
{
options.services.mappingmigration = {
enable = lib.mkEnableOption "Mapping migration Nginx config";
domain = lib.mkOption {
description = "The domain serving the webapp.";
example = "mappingmigration.example.org";
type = lib.types.str;
};
};
config = lib.mkIf cfg.enable {
services.nginx = {
enable = true;
virtualHosts."${cfg.domain}" = {
locations =
{
"= /mapping/asylum/favicon.ico" = {
root = webapp;
tryFiles = "$uri =404";
priority = 999;
};
"/mapping/asylum/assets/" = {
root = webapp;
tryFiles = "$uri =404";
priority = 999;
};
# catch all for everything else
"/mapping/asylum/" = {
root = webapp;
tryFiles = "/mapping/asylum/index.html =404";
priority = 1000;
};
"/".return = "301 /mapping/asylum/";
};
enableACME = true;
forceSSL = true;
};
};
};
}