diff options
author | Franz Pletz <fpletz@fnordicwalking.de> | 2018-06-29 19:17:54 +0200 |
---|---|---|
committer | Ruben Maher <ruben@maher.fyi> | 2018-10-01 02:07:43 +0930 |
commit | ebd38185c8f50535b251b487375a671f3943a6be (patch) | |
tree | f41bd427c86e487a209acbc3eab4a3d65fb75e1e /nixos/modules/services/web-servers | |
parent | b66d6f404ef73035dfb13acedf360ac796f38ec8 (diff) | |
download | nixlib-ebd38185c8f50535b251b487375a671f3943a6be.tar nixlib-ebd38185c8f50535b251b487375a671f3943a6be.tar.gz nixlib-ebd38185c8f50535b251b487375a671f3943a6be.tar.bz2 nixlib-ebd38185c8f50535b251b487375a671f3943a6be.tar.lz nixlib-ebd38185c8f50535b251b487375a671f3943a6be.tar.xz nixlib-ebd38185c8f50535b251b487375a671f3943a6be.tar.zst nixlib-ebd38185c8f50535b251b487375a671f3943a6be.zip |
nixos/nextcloud: init
Co-authored-by: Franz Pletz <fpletz@fnordicwalking.de> Co-authored-by: Robin Gloster <mail@glob.in> Co-authored-by: Janne Heß <janne@hess.ooo> Co-authored-by: Florian Klink <flokli@flokli.de>
Diffstat (limited to 'nixos/modules/services/web-servers')
-rw-r--r-- | nixos/modules/services/web-servers/nginx/default.nix | 17 | ||||
-rw-r--r-- | nixos/modules/services/web-servers/nginx/location-options.nix | 10 |
2 files changed, 24 insertions, 3 deletions
diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix index b231ee5a3f01..508398f03ace 100644 --- a/nixos/modules/services/web-servers/nginx/default.nix +++ b/nixos/modules/services/web-servers/nginx/default.nix @@ -245,8 +245,8 @@ let } '' ) virtualHosts); - mkLocations = locations: concatStringsSep "\n" (mapAttrsToList (location: config: '' - location ${location} { + mkLocations = locations: concatStringsSep "\n" (map (config: '' + location ${config.location} { ${optionalString (config.proxyPass != null && !cfg.proxyResolveWhileRunning) "proxy_pass ${config.proxyPass};" } @@ -266,7 +266,18 @@ let ${config.extraConfig} ${optionalString (config.proxyPass != null && cfg.recommendedProxySettings) "include ${recommendedProxyConfig};"} } - '') locations); + '') (sortProperties (mapAttrsToList (k: v: v // { location = k; }) locations))); + mkBasicAuth = vhostName: authDef: let + htpasswdFile = pkgs.writeText "${vhostName}.htpasswd" ( + concatStringsSep "\n" (mapAttrsToList (user: password: '' + ${user}:{PLAIN}${password} + '') authDef) + ); + in '' + auth_basic secured; + auth_basic_user_file ${htpasswdFile}; + ''; + mkHtpasswd = vhostName: authDef: pkgs.writeText "${vhostName}.htpasswd" ( concatStringsSep "\n" (mapAttrsToList (user: password: '' ${user}:{PLAIN}${password} diff --git a/nixos/modules/services/web-servers/nginx/location-options.nix b/nixos/modules/services/web-servers/nginx/location-options.nix index 4c772734a749..9b44433d3845 100644 --- a/nixos/modules/services/web-servers/nginx/location-options.nix +++ b/nixos/modules/services/web-servers/nginx/location-options.nix @@ -71,6 +71,16 @@ with lib; These lines go to the end of the location verbatim. ''; }; + + priority = mkOption { + type = types.int; + default = 1000; + description = '' + Order of this location block in relation to the others in the vhost. + The semantics are the same as with `lib.mkOrder`. Smaller values have + a greater priority. + ''; + }; }; } |