summaryrefslogtreecommitdiffstats
path: root/lass/3modules/static_nginx.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-02-11 21:31:15 +0100
committermakefu <github@syntax-fehler.de>2016-02-11 21:31:15 +0100
commit014cbb7598c5d45cfc4cc7e1ec81c92e000eabfb (patch)
treefab0e894948010cd73be18ad2c68cd4750bd2419 /lass/3modules/static_nginx.nix
parent8ecdb889dd3081ba29c6ea7eb35f60b30420d201 (diff)
parent7b3b839cc7a2af73dee9858e6ebcc7be831eb481 (diff)
Merge remote-tracking branch 'cd/master'
Diffstat (limited to 'lass/3modules/static_nginx.nix')
-rw-r--r--lass/3modules/static_nginx.nix44
1 files changed, 43 insertions, 1 deletions
diff --git a/lass/3modules/static_nginx.nix b/lass/3modules/static_nginx.nix
index cc2641af2..fd5cfdfd7 100644
--- a/lass/3modules/static_nginx.nix
+++ b/lass/3modules/static_nginx.nix
@@ -21,6 +21,35 @@ let
type = str;
default = "/srv/http/${config.domain}";
};
+ #sslEnable = mkEnableOption "ssl";
+ #certificate = mkOption {
+ # type = str;
+ #};
+ #certificate_key = mkOption {
+ # type = str;
+ #};
+ #ciphers = mkOption {
+ # type = str;
+ # default = "AES128+EECDH:AES128+EDH";
+ #};
+ ssl = mkOption {
+ type = with types; submodule ({
+ options = {
+ enable = mkEnableOption "ssl";
+ certificate = mkOption {
+ type = str;
+ };
+ certificate_key = mkOption {
+ type = str;
+ };
+ ciphers = mkOption {
+ type = str;
+ default = "AES128+EECDH:AES128+EDH";
+ };
+ };
+ });
+ default = {};
+ };
};
}));
default = {};
@@ -29,8 +58,10 @@ let
user = config.services.nginx.user;
group = config.services.nginx.group;
+ external-ip = head config.krebs.build.host.nets.internet.addrs4;
+
imp = {
- krebs.nginx.servers = flip mapAttrs cfg ( name: { domain, folder, ... }: {
+ krebs.nginx.servers = flip mapAttrs cfg ( name: { domain, folder, ssl, ... }: {
server-names = [
"${domain}"
"www.${domain}"
@@ -43,6 +74,17 @@ let
deny all;
'')
];
+
+ listen = (if ssl.enable then
+ [ "80" "443 ssl" ]
+ else
+ "80"
+ );
+ extraConfig = (if ssl.enable then ''
+ ssl_certificate ${ssl.certificate};
+ ssl_certificate_key ${ssl.certificate_key};
+ '' else "");
+
});
};