diff options
author | lassulus <lass@aidsballs.de> | 2015-12-12 18:20:50 +0100 |
---|---|---|
committer | lassulus <lass@aidsballs.de> | 2015-12-12 18:20:50 +0100 |
commit | 717c6f4adec48ac65050c693fd0722cd93355e81 (patch) | |
tree | 7fd48f2e8366bd8869478e42f35e4b45d6ad87f0 /lass/3modules/static_nginx.nix | |
parent | c8b82b0336f0913c70b5d1e51b0c1194ba9570d4 (diff) |
l 3: add nginx site modules
Diffstat (limited to 'lass/3modules/static_nginx.nix')
-rw-r--r-- | lass/3modules/static_nginx.nix | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lass/3modules/static_nginx.nix b/lass/3modules/static_nginx.nix new file mode 100644 index 000000000..cc2641af2 --- /dev/null +++ b/lass/3modules/static_nginx.nix @@ -0,0 +1,49 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.lass.staticPage; + + out = { + options.lass.staticPage = api; + config = imp; + }; + + api = mkOption { + type = with types; attrsOf (submodule ({ config, ... }: { + options = { + domain = mkOption { + type = str; + default = config._module.args.name; + }; + folder = mkOption { + type = str; + default = "/srv/http/${config.domain}"; + }; + }; + })); + default = {}; + }; + + user = config.services.nginx.user; + group = config.services.nginx.group; + + imp = { + krebs.nginx.servers = flip mapAttrs cfg ( name: { domain, folder, ... }: { + server-names = [ + "${domain}" + "www.${domain}" + ]; + locations = [ + (nameValuePair "/" '' + root ${folder}; + '') + (nameValuePair "~ /\\." '' + deny all; + '') + ]; + }); + }; + +in out |