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:
Eelco Dolstra
2014-04-14 16:26:48 +02:00
parent 4f2aa2f706
commit 29027fd1e1
322 changed files with 659 additions and 656 deletions
@@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
imports = [ ../profiles/headless.nix ./ec2-data.nix ];
+2 -2
View File
@@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
+2 -2
View File
@@ -2,9 +2,9 @@
# host name of virtual machines running on Amazon EC2, Eucalyptus and
# OpenStack Compute (Nova).
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
options = {
@@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
diskSize = "100G";
in
+2 -2
View File
@@ -1,8 +1,8 @@
# Systemd services for libvirtd.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
@@ -59,9 +59,9 @@ sub writeNixOSConfig {
my ($nixosConfigFile) = @_;
my $nixosConfig = <<EOF;
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{ boot.isContainer = true;
security.initialRootPassword = mkDefault "!";
+2 -2
View File
@@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
imports = [ ../profiles/qemu-guest.nix ../profiles/headless.nix ./ec2-data.nix ];
+2 -2
View File
@@ -1,8 +1,8 @@
# Module for Nova, a.k.a. OpenStack Compute.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
+2 -2
View File
@@ -7,9 +7,9 @@
# the VM in the host. On the other hand, the root filesystem is a
# read/writable disk image persistent across VM reboots.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
@@ -1,8 +1,8 @@
# Module for VirtualBox guests.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
@@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
system.build.virtualBoxImage =
+2 -2
View File
@@ -1,8 +1,8 @@
# Xen hypervisor (Dom0) support.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let