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 | nixpkgs-29027fd1e12461fc5ff5722bea79df7ff4299599.tar nixpkgs-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.gz nixpkgs-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.bz2 nixpkgs-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.lz nixpkgs-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.xz nixpkgs-29027fd1e12461fc5ff5722bea79df7ff4299599.tar.zst nixpkgs-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 949dce96824..eced13444de 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 f5669faebc9..7d59c13b957 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 53f34e28c27..b8e86334539 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 dc82fd34f2f..ad791d7d958 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 a6e6042fdf6..cab16593bcb 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 e1bcede6563..8a292ad6791 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 62264f1db45..dbff565bd8a 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 4cc34c65d84..3ba934c72bf 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 f02bd4db264..d49278be09a 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 62153613355..ff94ee42d28 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 6ffe4beaa5d..4a14f9b41a4 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 a68828de5d8..b5eee8f8be8 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 7e327120c3d..364f6c68fac 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 33c7e730118..7f48012f158 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 576f4b08fb9..21117118457 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 |