diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-14 16:26:48 +0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2014-04-14 16:26:48 +0200 |
commit | 29027fd1e12461fc5ff5722bea79df7ff4299599 (patch) | |
tree | fec0d7ba9f295be106fcf41759cee8b94d79dc9d /nixos/modules/services/web-servers | |
parent | 4f2aa2f7061984fa7aa21bac92ed5eec3f3daa06 (diff) | |
download | nixlib-29027fd1e12461fc5ff5722bea79df7ff4299599.tar nixlib-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.gz nixlib-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.bz2 nixlib-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.lz nixlib-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.xz nixlib-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.zst nixlib-29027fd1e12461fc5ff5722bea79df7ff4299599.zip |
Rewrite ‘with pkgs.lib’ -> ‘with lib’
Using pkgs.lib on the spine of module evaluation is problematic because the pkgs argument depends on the result of module evaluation. To prevent an infinite recursion, pkgs and some of the modules are evaluated twice, which is inefficient. Using ‘with lib’ prevents this problem.
Diffstat (limited to 'nixos/modules/services/web-servers')
15 files changed, 38 insertions, 36 deletions
diff --git a/nixos/modules/services/web-servers/apache-httpd/default.nix b/nixos/modules/services/web-servers/apache-httpd/default.nix index 949dce96824b..eced13444de2 100644 --- a/nixos/modules/services/web-servers/apache-httpd/default.nix +++ b/nixos/modules/services/web-servers/apache-httpd/default.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let @@ -65,7 +65,7 @@ let options = {}; documentRoot = null; }; - res = defaults // svcFunction { inherit config pkgs serverInfo php; }; + res = defaults // svcFunction { inherit config lib pkgs serverInfo php; }; in res; in map f defs; @@ -510,7 +510,7 @@ in virtualHosts = mkOption { type = types.listOf (types.submodule ( { options = import ./per-server-options.nix { - inherit pkgs; + inherit lib; forMainServer = false; }; })); @@ -577,7 +577,7 @@ in # Include the options shared between the main server and virtual hosts. // (import ./per-server-options.nix { - inherit pkgs; + inherit lib; forMainServer = true; }); diff --git a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix index f5669faebc97..7d59c13b9575 100644 --- a/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix +++ b/nixos/modules/services/web-servers/apache-httpd/mediawiki.nix @@ -1,6 +1,6 @@ -{ config, pkgs, serverInfo, php, ... }: +{ config, lib, pkgs, serverInfo, php, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix index 53f34e28c27e..b8e863345398 100644 --- a/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix +++ b/nixos/modules/services/web-servers/apache-httpd/per-server-options.nix @@ -3,9 +3,9 @@ # has additional options that affect the web server as a whole, like # the user/group to run under.) -{ forMainServer, pkgs }: +{ forMainServer, lib }: -with pkgs.lib; +with lib; { diff --git a/nixos/modules/services/web-servers/apache-httpd/trac.nix b/nixos/modules/services/web-servers/apache-httpd/trac.nix index dc82fd34f2fa..ad791d7d9582 100644 --- a/nixos/modules/services/web-servers/apache-httpd/trac.nix +++ b/nixos/modules/services/web-servers/apache-httpd/trac.nix @@ -1,6 +1,6 @@ -{ config, pkgs, serverInfo, ... }: +{ config, lib, pkgs, serverInfo, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/services/web-servers/apache-httpd/zabbix.nix b/nixos/modules/services/web-servers/apache-httpd/zabbix.nix index a6e6042fdf6d..cab16593bcbc 100644 --- a/nixos/modules/services/web-servers/apache-httpd/zabbix.nix +++ b/nixos/modules/services/web-servers/apache-httpd/zabbix.nix @@ -1,4 +1,6 @@ -{ config, pkgs, serverInfo, ... }: +{ config, lib, pkgs, serverInfo, ... }: + +with lib; let @@ -51,7 +53,7 @@ in options = { - urlPrefix = pkgs.lib.mkOption { + urlPrefix = mkOption { default = "/zabbix"; description = " The URL prefix under which the Zabbix service appears. @@ -59,9 +61,9 @@ in "; }; - configFile = pkgs.lib.mkOption { + configFile = mkOption { default = null; - type = with pkgs.lib.types; nullOr path; + type = types.nullOr types.path; description = '' The configuration file (zabbix.conf.php) which contains the database connection settings. If not set, the configuration settings will created @@ -69,7 +71,7 @@ in ''; }; - stateDir = pkgs.lib.mkOption { + stateDir = mkOption { default = "/var/lib/zabbix/frontend"; description = " Directory where the dynamically generated configuration data diff --git a/nixos/modules/services/web-servers/jboss/default.nix b/nixos/modules/services/web-servers/jboss/default.nix index e1bcede6563c..8a292ad67917 100644 --- a/nixos/modules/services/web-servers/jboss/default.nix +++ b/nixos/modules/services/web-servers/jboss/default.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/services/web-servers/lighttpd/cgit.nix b/nixos/modules/services/web-servers/lighttpd/cgit.nix index 62264f1db452..dbff565bd8a3 100644 --- a/nixos/modules/services/web-servers/lighttpd/cgit.nix +++ b/nixos/modules/services/web-servers/lighttpd/cgit.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let cfg = config.services.lighttpd.cgit; diff --git a/nixos/modules/services/web-servers/lighttpd/default.nix b/nixos/modules/services/web-servers/lighttpd/default.nix index 4cc34c65d843..3ba934c72bf8 100644 --- a/nixos/modules/services/web-servers/lighttpd/default.nix +++ b/nixos/modules/services/web-servers/lighttpd/default.nix @@ -1,8 +1,8 @@ # NixOS module for lighttpd web server -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/services/web-servers/lighttpd/gitweb.nix b/nixos/modules/services/web-servers/lighttpd/gitweb.nix index f02bd4db2645..d49278be09a8 100644 --- a/nixos/modules/services/web-servers/lighttpd/gitweb.nix +++ b/nixos/modules/services/web-servers/lighttpd/gitweb.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let cfg = config.services.lighttpd.gitweb; diff --git a/nixos/modules/services/web-servers/nginx/default.nix b/nixos/modules/services/web-servers/nginx/default.nix index 621536133554..ff94ee42d28d 100644 --- a/nixos/modules/services/web-servers/nginx/default.nix +++ b/nixos/modules/services/web-servers/nginx/default.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let cfg = config.services.nginx; diff --git a/nixos/modules/services/web-servers/phpfpm.nix b/nixos/modules/services/web-servers/phpfpm.nix index 6ffe4beaa5d5..4a14f9b41a42 100644 --- a/nixos/modules/services/web-servers/phpfpm.nix +++ b/nixos/modules/services/web-servers/phpfpm.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let cfg = config.services.phpfpm; diff --git a/nixos/modules/services/web-servers/tomcat.nix b/nixos/modules/services/web-servers/tomcat.nix index a68828de5d8e..b5eee8f8be8f 100644 --- a/nixos/modules/services/web-servers/tomcat.nix +++ b/nixos/modules/services/web-servers/tomcat.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/services/web-servers/varnish/default.nix b/nixos/modules/services/web-servers/varnish/default.nix index 7e327120c3d1..364f6c68faca 100644 --- a/nixos/modules/services/web-servers/varnish/default.nix +++ b/nixos/modules/services/web-servers/varnish/default.nix @@ -1,9 +1,9 @@ -{ config, pkgs, ...}: +{ config, lib, pkgs, ...}: let cfg = config.services.varnish; in -with pkgs.lib; +with lib; { options = { services.varnish = { diff --git a/nixos/modules/services/web-servers/winstone.nix b/nixos/modules/services/web-servers/winstone.nix index 33c7e7301182..7f48012f158e 100644 --- a/nixos/modules/services/web-servers/winstone.nix +++ b/nixos/modules/services/web-servers/winstone.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/services/web-servers/zope2.nix b/nixos/modules/services/web-servers/zope2.nix index 576f4b08fb90..21117118457d 100644 --- a/nixos/modules/services/web-servers/zope2.nix +++ b/nixos/modules/services/web-servers/zope2.nix @@ -1,6 +1,6 @@ -{ pkgs, config, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let |