summaryrefslogtreecommitdiffstats
path: root/lass/3modules/static_nginx.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2015-12-14 17:04:32 +0100
committermakefu <github@syntax-fehler.de>2015-12-14 17:04:32 +0100
commit8114470587b5c0018cdfcb6b0c0da93bfece5a05 (patch)
tree343ca79a42402fca2b66af3579aa8d11e891cd7f /lass/3modules/static_nginx.nix
parent781573b9dd393aa4d2d7e34a1fa8d831441b545b (diff)
parent6f150af8acf2195188518bf53d0330da7a4bb8f8 (diff)
Merge branch 'master' of gum:stockholm
Diffstat (limited to 'lass/3modules/static_nginx.nix')
-rw-r--r--lass/3modules/static_nginx.nix49
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