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

View File

@ -188,9 +188,9 @@ commands to be executed periodically by <command>cron</command>).</para>
<example xml:id='locate-example'><title>NixOS module for the “locate” service</title>
<programlisting>
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let locatedb = "/var/cache/locatedb"; in

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
options = {

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
with pkgs;
let

View File

@ -1,8 +1,8 @@
# /etc files related to networking, such as /etc/services.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
options = {

View File

@ -1,8 +1,8 @@
# Configuration for the Name Service Switch (/etc/nsswitch.conf).
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
with pkgs;
let

View File

@ -1,9 +1,9 @@
# This module defines a global environment configuration and
# a common configuration for all shells.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, utils, ... }:
{ config, lib, pkgs, utils, ... }:
with pkgs.lib;
with lib;
with utils;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,9 +1,9 @@
# This module defines the packages that appear in
# /run/current-system/sw.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
options = {

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
# unixODBC drivers (this solution is not perfect.. Because the user has to
# ask the admin to add a driver.. but it's simple and works

View File

@ -1,6 +1,6 @@
{pkgs, config, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let kernelVersion = config.boot.kernelPackages.kernel.version; in

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,7 +1,7 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
let kernel = config.boot.kernelPackages; in
with pkgs.lib;
with lib;
{

View File

@ -1,9 +1,9 @@
# Provide an initial copy of the NixOS channel so that the user
# doesn't need to run "nix-channel --update" first.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,9 +1,9 @@
# This module contains the basic configuration for building a NixOS
# installation CD.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
imports =

View File

@ -1,9 +1,9 @@
# This module defines a NixOS installation CD that contains X11 and
# KDE 4.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
imports = [ ./installation-cd-base.nix ../../profiles/graphical.nix ];

View File

@ -2,9 +2,9 @@
# configuration. The derivation for the ISO image will be placed in
# config.system.build.isoImage.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,9 +1,9 @@
# This module contains the basic configuration for building a NixOS
# tarball, that can directly boot, maybe using PXE or unpacking on a fs.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,9 +1,9 @@
# This module contains the basic configuration for building a NixOS
# tarball for the sheevaplug.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -2,9 +2,9 @@
# configuration. The derivation for the ISO image will be placed in
# config.system.build.tarball.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,8 +1,8 @@
# List all devices which are detected by nixos-hardware-scan.
# Common devices are enabled by default.
{config, pkgs, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
config = mkDefault {

View File

@ -1,8 +1,8 @@
# List all devices which are _not_ detected by nixos-hardware-scan.
# Common devices are enabled by default.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
hardware.enableAllFirmware = true;

View File

@ -1,9 +1,9 @@
# This module generates the nixos-checkout script, which replaces the
# Nixpkgs source trees in /etc/nixos/nixpkgs with a Git checkout.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -80,9 +80,9 @@ in
/*
options = {
installer.enableGraphicalTools = pkgs.lib.mkOption {
installer.enableGraphicalTools = mkOption {
default = false;
type = with pkgs.lib.types; bool;
type = types.bool;
example = true;
description = ''
Enable the installation of graphical tools.

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
imports =

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ pkgs, ... }:
{ lib, ... }:
with pkgs.lib;
with lib;
{
options = {

View File

@ -1,6 +1,6 @@
{pkgs, config, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
crashdump = config.boot.crashDump;

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
isConfig = x:

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, modules, ... }:
{ config, lib, pkgs, modules, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,9 +1,9 @@
# Common configuration for headless machines (e.g., Amazon EC2
# instances).
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
sound.enable = false;

View File

@ -1,7 +1,7 @@
# Provide a basic configuration for installation devices like CDs.
{ config, pkgs, modules, ... }:
{ config, lib, ... }:
with pkgs.lib;
with lib;
{
imports =
@ -45,7 +45,7 @@ with pkgs.lib;
# Enable wpa_supplicant, but don't start it by default.
networking.wireless.enable = true;
jobs.wpa_supplicant.startOn = pkgs.lib.mkOverride 50 "";
jobs.wpa_supplicant.startOn = mkOverride 50 "";
# Tell the Nix evaluator to garbage collect more aggressively.
# This is desirable in memory-constrained environments that don't

View File

@ -1,8 +1,8 @@
# Global configuration for atop.
{config, pkgs, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let cfg = config.programs.atop;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1,8 +1,8 @@
# This module defines a standard configuration for NixOS shells.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -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;

View File

@ -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

View File

@ -1,6 +1,6 @@
{config, pkgs, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
cfg = config.services.venus;

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let virtualbox = config.boot.kernelPackages.virtualbox; in

View File

@ -1,8 +1,8 @@
# Global configuration for wvdial.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,8 +1,8 @@
# This module defines global configuration for the zshell.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, options, ... }:
{ config, lib, options, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,8 +1,8 @@
{pkgs, config, ...}:
{ config, lib, pkgs, ... }:
let
cfg = config.security.apparmor;
in
with pkgs.lib;
with lib;
{
options.security.apparmor.confineSUIDApplications = mkOption {

View File

@ -1,10 +1,10 @@
{pkgs, config, ...}:
{ config, lib, pkgs, ... }:
let
cfg = config.security.apparmor;
in
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
cfg = config.security.duosec;

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
cfg = config.security.grsecurity;

View File

@ -1,9 +1,9 @@
# This module provides configuration for the PAM (Pluggable
# Authentication Modules) system.
{config, pkgs, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{config, pkgs, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{config, pkgs, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
cfg = config.services.prey;

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{
options = {

View File

@ -1,9 +1,9 @@
# A module for rtkit, a DBus system service that hands out realtime
# scheduling priority to processes that ask for it.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
{

View File

@ -1,6 +1,6 @@
{pkgs, config, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{pkgs, config, ...}:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
with pkgs;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
cfg = config.services.rabbitmq;

View File

@ -1,7 +1,7 @@
# ALSA sound support.
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,10 +1,10 @@
{config, pkgs, ...}:
{ config, lib, pkgs, ... }:
let
cfg = config.services.fuppesd;
in
with pkgs.lib;
with lib;
{
options = {

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
cfg = config.services.almir;

View File

@ -1,9 +1,9 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
# TODO: test configuration when building nixexpr (use -t parameter)
# TODO: support sqlite3 (it's deprecate?) and mysql
with pkgs.lib;
with lib;
let
libDir = "/var/lib/bacula";

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
inherit (pkgs) postgresql gzip;

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let cfg = config.services.rsnapshot;
in

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
inherit (pkgs) sitecopy;

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let
cfg = config.services.tarsnap;

View File

@ -1,5 +1,5 @@
{ config, pkgs, ... }:
with pkgs.lib;
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.jenkins;
in {

View File

@ -1,5 +1,5 @@
{ config, pkgs, ... }:
with pkgs.lib;
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.jenkinsSlave;
masterCfg = config.services.jenkins;

View File

@ -1,10 +1,10 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
cfg = config.services.fourStoreEndpoint;
endpointUser = "fourstorehttp";
run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${endpointUser} -c";
in
with pkgs.lib;
with lib;
{
###### interface

View File

@ -1,11 +1,11 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
cfg = config.services.fourStore;
stateDir = "/var/lib/4store";
fourStoreUser = "fourstore";
run = "${pkgs.su}/bin/su -s ${pkgs.stdenv.shell} ${fourStoreUser}";
in
with pkgs.lib;
with lib;
{
###### interface

View File

@ -1,5 +1,6 @@
{ config, pkgs, ... }:
with pkgs.lib;
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.couchdb;

View File

@ -1,4 +1,4 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
# TODO: This may file may need additional review, eg which configuartions to
# expose to the user.
@ -19,7 +19,7 @@
# Eg superserver is said to be most efficiently using resources according to
# http://www.firebirdsql.org/manual/qsg25-classic-or-super.html
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,9 +1,9 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
let
cfg = config.services.monetdb;
monetdbUser = "monetdb";
in
with pkgs.lib;
with lib;
{
###### interface

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

View File

@ -1,6 +1,6 @@
{ config, pkgs, ... }:
{ config, lib, pkgs, ... }:
with pkgs.lib;
with lib;
let

Some files were not shown because too many files have changed in this diff Show More