diff options
author | makefu <github@syntax-fehler.de> | 2015-12-14 17:04:32 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2015-12-14 17:04:32 +0100 |
commit | 8114470587b5c0018cdfcb6b0c0da93bfece5a05 (patch) | |
tree | 343ca79a42402fca2b66af3579aa8d11e891cd7f /lass/3modules/static_nginx.nix | |
parent | 781573b9dd393aa4d2d7e34a1fa8d831441b545b (diff) | |
parent | 6f150af8acf2195188518bf53d0330da7a4bb8f8 (diff) |
Merge branch 'master' of gum:stockholm
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 |