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;
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user