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/programs/atop.nix | 4 ++-- nixos/modules/programs/bash/bash.nix | 4 ++-- nixos/modules/programs/bash/command-not-found.nix | 4 ++-- nixos/modules/programs/environment.nix | 4 ++-- nixos/modules/programs/shadow.nix | 4 ++-- nixos/modules/programs/shell.nix | 4 ++-- nixos/modules/programs/ssh.nix | 4 ++-- nixos/modules/programs/ssmtp.nix | 4 ++-- nixos/modules/programs/venus.nix | 4 ++-- nixos/modules/programs/virtualbox.nix | 4 ++-- nixos/modules/programs/wvdial.nix | 4 ++-- nixos/modules/programs/zsh/zsh.nix | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) (limited to 'nixos/modules/programs') diff --git a/nixos/modules/programs/atop.nix b/nixos/modules/programs/atop.nix index 7fdaab9d67d..e457db22333 100644 --- a/nixos/modules/programs/atop.nix +++ b/nixos/modules/programs/atop.nix @@ -1,8 +1,8 @@ # Global configuration for atop. -{config, pkgs, ...}: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let cfg = config.programs.atop; diff --git a/nixos/modules/programs/bash/bash.nix b/nixos/modules/programs/bash/bash.nix index 9d33e26c495..9584f07b094 100644 --- a/nixos/modules/programs/bash/bash.nix +++ b/nixos/modules/programs/bash/bash.nix @@ -1,9 +1,9 @@ # This module defines global configuration for the Bash shell, in # particular /etc/bashrc and /etc/profile. -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/programs/bash/command-not-found.nix b/nixos/modules/programs/bash/command-not-found.nix index 502320446a3..8c86d48b080 100644 --- a/nixos/modules/programs/bash/command-not-found.nix +++ b/nixos/modules/programs/bash/command-not-found.nix @@ -3,9 +3,9 @@ # SQLite database that maps program names to Nix package names (e.g., # "pdflatex" is mapped to "tetex"). -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/programs/environment.nix b/nixos/modules/programs/environment.nix index 489a7a4d269..831c04f1ad8 100644 --- a/nixos/modules/programs/environment.nix +++ b/nixos/modules/programs/environment.nix @@ -2,9 +2,9 @@ # Most of the stuff here should probably be moved elsewhere sometime. -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/programs/shadow.nix b/nixos/modules/programs/shadow.nix index 15b083b72d2..a2435099499 100644 --- a/nixos/modules/programs/shadow.nix +++ b/nixos/modules/programs/shadow.nix @@ -1,8 +1,8 @@ # Configuration for the pwdutils suite of tools: passwd, useradd, etc. -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/programs/shell.nix b/nixos/modules/programs/shell.nix index 226105a0c97..80d40a7c708 100644 --- a/nixos/modules/programs/shell.nix +++ b/nixos/modules/programs/shell.nix @@ -1,8 +1,8 @@ # This module defines a standard configuration for NixOS shells. -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/programs/ssh.nix b/nixos/modules/programs/ssh.nix index 89333533465..27db667e440 100644 --- a/nixos/modules/programs/ssh.nix +++ b/nixos/modules/programs/ssh.nix @@ -1,8 +1,8 @@ # Global configuration for the SSH client. -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let cfg = config.programs.ssh; cfgd = config.services.openssh; diff --git a/nixos/modules/programs/ssmtp.nix b/nixos/modules/programs/ssmtp.nix index 904989d57a0..34eafd4fa84 100644 --- a/nixos/modules/programs/ssmtp.nix +++ b/nixos/modules/programs/ssmtp.nix @@ -3,9 +3,9 @@ # directly to an SMTP server defined in its configuration file, wihout # queueing mail locally. -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/programs/venus.nix b/nixos/modules/programs/venus.nix index 7ab653dd19f..2b70a795f4f 100644 --- a/nixos/modules/programs/venus.nix +++ b/nixos/modules/programs/venus.nix @@ -1,6 +1,6 @@ -{config, pkgs, ...}: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let cfg = config.services.venus; diff --git a/nixos/modules/programs/virtualbox.nix b/nixos/modules/programs/virtualbox.nix index 340fec0496a..10e657abd3c 100644 --- a/nixos/modules/programs/virtualbox.nix +++ b/nixos/modules/programs/virtualbox.nix @@ -1,6 +1,6 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let virtualbox = config.boot.kernelPackages.virtualbox; in diff --git a/nixos/modules/programs/wvdial.nix b/nixos/modules/programs/wvdial.nix index da3f7dce98a..8e7d0e51a4e 100644 --- a/nixos/modules/programs/wvdial.nix +++ b/nixos/modules/programs/wvdial.nix @@ -1,8 +1,8 @@ # Global configuration for wvdial. -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let diff --git a/nixos/modules/programs/zsh/zsh.nix b/nixos/modules/programs/zsh/zsh.nix index 69a56ff69a0..7bcf8da2c65 100644 --- a/nixos/modules/programs/zsh/zsh.nix +++ b/nixos/modules/programs/zsh/zsh.nix @@ -1,8 +1,8 @@ # This module defines global configuration for the zshell. -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: -with pkgs.lib; +with lib; let -- cgit 1.4.1