From 29027fd1e12461fc5ff5722bea79df7ff4299599 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 14 Apr 2014 16:26:48 +0200 Subject: Rewrite ‘with pkgs.lib’ -> ‘with lib’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- nixos/modules/system/activation/activation-script.nix | 4 ++-- nixos/modules/system/activation/no-clone.nix | 4 ++-- nixos/modules/system/activation/top-level.nix | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) (limited to 'nixos/modules/system/activation') diff --git a/nixos/modules/system/activation/activation-script.nix b/nixos/modules/system/activation/activation-script.nix index 1545bcb8a1f9..41fe7d309a5a 100644 --- a/nixos/modules/system/activation/activation-script.nix +++ b/nixos/modules/system/activation/activation-script.nix @@ -1,7 +1,7 @@ # generate the script used to activate the configuration. -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/system/activation/no-clone.nix b/nixos/modules/system/activation/no-clone.nix index c9ab691ce477..7f4584435266 100644 --- a/nixos/modules/system/activation/no-clone.nix +++ b/nixos/modules/system/activation/no-clone.nix @@ -1,6 +1,6 @@ -{pkgs, ...}: +{ lib, ... }: -with pkgs.lib; +with lib; { boot.loader.grub.device = mkOverride 0 "nodev"; diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix index d9891f434cc8..a4a0d14df6ab 100644 --- a/nixos/modules/system/activation/top-level.nix +++ b/nixos/modules/system/activation/top-level.nix @@ -1,6 +1,6 @@ -{ config, pkgs, modules, baseModules, ... }: +{ config, lib, pkgs, modules, baseModules, ... }: -with pkgs.lib; +with lib; let @@ -11,7 +11,7 @@ let # you can provide an easy way to boot the same configuration # as you use, but with another kernel # !!! fix this - cloner = inheritParent: list: with pkgs.lib; + cloner = inheritParent: list: map (childConfig: (import ../../../lib/eval-config.nix { inherit baseModules; -- cgit 1.4.1