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.
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ config, pkgs, serverInfo, php, ... }:
|
||||
{ config, lib, pkgs, serverInfo, php, ... }:
|
||||
|
||||
with pkgs.lib;
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ config, pkgs, serverInfo, ... }:
|
||||
{ config, lib, pkgs, serverInfo, ... }:
|
||||
|
||||
with pkgs.lib;
|
||||
with lib;
|
||||
|
||||
let
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user