nginx service: add port option and extraConfig

This commit is contained in:
tv 2015-10-19 20:36:09 +02:00
parent a928574806
commit 222ca361e3

View File

@ -24,9 +24,17 @@ let
"${config.networking.hostName}.retiolum" "${config.networking.hostName}.retiolum"
]; ];
}; };
port = mkOption {
type = with types; int;
default = 80;
};
locations = mkOption { locations = mkOption {
type = with types; listOf (attrsOf str); type = with types; listOf (attrsOf str);
}; };
extraConfig = mkOption {
type = with types; str;
default = "";
};
}; };
default = {}; default = {};
}; };
@ -60,10 +68,11 @@ let
} }
''; '';
to-server = { server-names, locations, ... }: '' to-server = { server-names, port, locations, extraConfig, ... }: ''
server { server {
listen 80; listen ${toString port};
server_name ${toString server-names}; server_name ${toString server-names};
${extraConfig}
${indent (concatStrings (map to-location locations))} ${indent (concatStrings (map to-location locations))}
} }
''; '';