summary refs log tree commit diff
path: root/nixos/modules/services/web-servers/apache-httpd/default.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-28 21:58:32 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2013-10-28 22:45:58 +0100
commitf8a9eb9f00ae84bc2daef9b78d2bd5153ffe81b6 (patch)
tree5261da35eea2ebc80c3786c87f722b922fe21bc2 /nixos/modules/services/web-servers/apache-httpd/default.nix
parent30a36f9a80b998f7f4bca8e5246c2dfa1946771c (diff)
downloadnixpkgs-f8a9eb9f00ae84bc2daef9b78d2bd5153ffe81b6.tar
nixpkgs-f8a9eb9f00ae84bc2daef9b78d2bd5153ffe81b6.tar.gz
nixpkgs-f8a9eb9f00ae84bc2daef9b78d2bd5153ffe81b6.tar.bz2
nixpkgs-f8a9eb9f00ae84bc2daef9b78d2bd5153ffe81b6.tar.lz
nixpkgs-f8a9eb9f00ae84bc2daef9b78d2bd5153ffe81b6.tar.xz
nixpkgs-f8a9eb9f00ae84bc2daef9b78d2bd5153ffe81b6.tar.zst
nixpkgs-f8a9eb9f00ae84bc2daef9b78d2bd5153ffe81b6.zip
Implement services.httpd.virtualHosts using the module system
Diffstat (limited to 'nixos/modules/services/web-servers/apache-httpd/default.nix')
-rw-r--r--nixos/modules/services/web-servers/apache-httpd/default.nix30
1 files changed, 11 insertions, 19 deletions
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix
index e2cfc5cdb26..7688b04f1c1 100644
--- a/nixos/modules/services/web-servers/apache-httpd/default.nix
+++ b/nixos/modules/services/web-servers/apache-httpd/default.nix
@@ -38,21 +38,7 @@ let
   };
 
 
-  vhostOptions = import ./per-server-options.nix {
-    inherit mkOption;
-    forMainServer = false;
-  };
-
-  vhosts = let
-    makeVirtualHost = cfgIn:
-      let
-        # Fill in defaults for missing options.
-        cfg = addDefaultOptionValues vhostOptions cfgIn;
-      in cfg;
-    in map makeVirtualHost mainCfg.virtualHosts;
-
-
-  allHosts = [mainCfg] ++ vhosts;
+  allHosts = [mainCfg] ++ mainCfg.virtualHosts;
 
 
   callSubservices = serverInfo: defs:
@@ -86,7 +72,7 @@ let
 
   mainSubservices = subservicesFor mainCfg;
 
-  allSubservices = mainSubservices ++ concatMap subservicesFor vhosts;
+  allSubservices = mainSubservices ++ concatMap subservicesFor mainCfg.virtualHosts;
 
 
   # !!! should be in lib
@@ -389,7 +375,7 @@ let
               ${perServerConf false vhost}
           </VirtualHost>
         '';
-      in concatMapStrings makeVirtualHost vhosts
+      in concatMapStrings makeVirtualHost mainCfg.virtualHosts
     }
   '';
 
@@ -428,7 +414,7 @@ in
 
       package = mkOption {
         default = pkgs.apacheHttpd.override { mpm = mainCfg.multiProcessingModule; };
-	example = "pkgs.apacheHttpd_2_4";
+        example = "pkgs.apacheHttpd_2_4";
         description = "
           Overridable attribute of the Apache HTTP Server package to use.
         ";
@@ -436,7 +422,7 @@ in
 
       configFile = mkOption {
         default = confFile;
-	example = ''pkgs.writeText "httpd.conf" "# my custom config file ...";'';
+        example = literalExample ''pkgs.writeText "httpd.conf" "# my custom config file ...";'';
         description = "
           Overridable config file to use for Apache. By default, use the
           file automatically generated by nixos.
@@ -507,6 +493,12 @@ in
       };
 
       virtualHosts = mkOption {
+        type = types.listOf (types.submodule (
+          { options = import ./per-server-options.nix {
+              inherit mkOption;
+              forMainServer = false;
+            };
+          }));
         default = [];
         example = [
           { hostName = "foo";