Author: eelco
Date: Fri Mar 2 12:38:22 2012
New Revision: 32739
URL: https://nixos.org/websvn/nix/?rev=32739&sc=1
Log:
* Remove the use of the NIXPKGS and NIXOS environment variables.
Instead use $NIX_PATH. NIXOS_CONFIG is still supported.
Modified:
nixos/trunk/default.nix
nixos/trunk/doc/manual/man-nixos-build-vms.xml
nixos/trunk/doc/manual/man-nixos-deploy-network.xml
nixos/trunk/doc/manual/man-nixos-option.xml
nixos/trunk/doc/manual/man-nixos-rebuild.xml
nixos/trunk/lib/build-vms.nix
nixos/trunk/lib/eval-config.nix
nixos/trunk/lib/testing.nix
nixos/trunk/maintainers/option-usages.nix
nixos/trunk/modules/installer/tools/nixos-build-vms/build-vms.nix
nixos/trunk/modules/installer/tools/nixos-build-vms/nixos-build-vms.sh
nixos/trunk/modules/installer/tools/nixos-install.sh
nixos/trunk/modules/installer/tools/nixos-option.sh
nixos/trunk/modules/installer/tools/nixos-rebuild.sh
nixos/trunk/modules/programs/bash/profile.sh
nixos/trunk/tests/default.nix
Modified: nixos/trunk/default.nix
==============================================================================
--- nixos/trunk/default.nix Fri Mar 2 12:36:07 2012 (r32738)
+++ nixos/trunk/default.nix Fri Mar 2 12:38:22 2012 (r32739)
@@ -1,4 +1,4 @@
-{ configuration ? import ./lib/from-env.nix "NIXOS_CONFIG"
/etc/nixos/configuration.nix
+{ configuration ? import ./lib/from-env.nix "NIXOS_CONFIG" <nixos-config>
, system ? builtins.currentSystem
}:
Modified: nixos/trunk/doc/manual/man-nixos-build-vms.xml
==============================================================================
--- nixos/trunk/doc/manual/man-nixos-build-vms.xml Fri Mar 2 12:36:07
2012 (r32738)
+++ nixos/trunk/doc/manual/man-nixos-build-vms.xml Fri Mar 2 12:38:22
2012 (r32739)
@@ -107,27 +107,4 @@
</refsection>
-<refsection><title>Environment variables</title>
-
-<variablelist>
-
- <varlistentry>
- <term><envar>NIXOS</envar></term>
- <listitem>
- <para>Path to the NixOS source tree. Defaults to
- <filename>/etc/nixos/nixos</filename>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><envar>NIXPKGS_ALL</envar></term>
- <listitem>
- <para>Path to the Nixpkgs source tree. Defaults to
- <filename>/etc/nixos/nixpkgs</filename>.</para>
- </listitem>
- </varlistentry>
-</variablelist>
-
-</refsection>
-
</refentry>
Modified: nixos/trunk/doc/manual/man-nixos-deploy-network.xml
==============================================================================
--- nixos/trunk/doc/manual/man-nixos-deploy-network.xml Fri Mar 2 12:36:07
2012 (r32738)
+++ nixos/trunk/doc/manual/man-nixos-deploy-network.xml Fri Mar 2 12:38:22
2012 (r32739)
@@ -109,27 +109,4 @@
</refsection>
-<refsection><title>Environment variables</title>
-
-<variablelist>
-
- <varlistentry>
- <term><envar>NIXOS</envar></term>
- <listitem>
- <para>Path to the NixOS source tree. Defaults to
- <filename>/etc/nixos/nixos</filename>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><envar>NIXPKGS_ALL</envar></term>
- <listitem>
- <para>Path to the Nixpkgs source tree. Defaults to
- <filename>/etc/nixos/nixpkgs</filename>.</para>
- </listitem>
- </varlistentry>
-</variablelist>
-
-</refsection>
-
</refentry>
Modified: nixos/trunk/doc/manual/man-nixos-option.xml
==============================================================================
--- nixos/trunk/doc/manual/man-nixos-option.xml Fri Mar 2 12:36:07 2012
(r32738)
+++ nixos/trunk/doc/manual/man-nixos-option.xml Fri Mar 2 12:38:22 2012
(r32739)
@@ -112,22 +112,6 @@
</varlistentry>
<varlistentry>
- <term><envar>NIXOS</envar></term>
- <listitem>
- <para>Path to the NixOS source tree. Defaults to
- <filename>/etc/nixos/nixos</filename>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><envar>NIXPKGS</envar></term>
- <listitem>
- <para>Path to the Nixpkgs source tree. Defaults to
- <filename>/etc/nixos/nixpkgs</filename>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term><envar>NIXOS_CONFIG</envar></term>
<listitem>
<para>Path to the main NixOS configuration module. Defaults to
Modified: nixos/trunk/doc/manual/man-nixos-rebuild.xml
==============================================================================
--- nixos/trunk/doc/manual/man-nixos-rebuild.xml Fri Mar 2 12:36:07
2012 (r32738)
+++ nixos/trunk/doc/manual/man-nixos-rebuild.xml Fri Mar 2 12:38:22
2012 (r32739)
@@ -272,22 +272,6 @@
<variablelist>
<varlistentry>
- <term><envar>NIXOS</envar></term>
- <listitem>
- <para>Path to the NixOS source tree. Defaults to
- <filename>/etc/nixos/nixos</filename>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><envar>NIXPKGS</envar></term>
- <listitem>
- <para>Path to the Nixpkgs source tree. Defaults to
- <filename>/etc/nixos/nixpkgs</filename>.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
<term><envar>NIXOS_CONFIG</envar></term>
<listitem>
<para>Path to the main NixOS configuration module. Defaults to
Modified: nixos/trunk/lib/build-vms.nix
==============================================================================
--- nixos/trunk/lib/build-vms.nix Fri Mar 2 12:36:07 2012 (r32738)
+++ nixos/trunk/lib/build-vms.nix Fri Mar 2 12:38:22 2012 (r32739)
@@ -1,6 +1,6 @@
-{ nixpkgs, system }:
+{ system }:
-let pkgs = import nixpkgs { config = {}; inherit system; }; in
+let pkgs = import <nixpkgs> { config = {}; inherit system; }; in
with pkgs;
with import ../lib/qemu-flags.nix;
@@ -22,7 +22,7 @@
nodes: configurations:
import ./eval-config.nix {
- inherit nixpkgs system;
+ inherit system;
modules = configurations ++
[ ../modules/virtualisation/qemu-vm.nix
../modules/testing/test-instrumentation.nix # !!! should only get
added for automated test runs
Modified: nixos/trunk/lib/eval-config.nix
==============================================================================
--- nixos/trunk/lib/eval-config.nix Fri Mar 2 12:36:07 2012 (r32738)
+++ nixos/trunk/lib/eval-config.nix Fri Mar 2 12:38:22 2012 (r32739)
@@ -3,7 +3,6 @@
# values.
{ system ? builtins.currentSystem
-, nixpkgs ? import ./from-env.nix "NIXPKGS" /etc/nixos/nixpkgs
, pkgs ? null
, baseModules ? import ../modules/module-list.nix
, extraArgs ? {}
@@ -31,7 +30,7 @@
extraArgs = extraArgs_ // {
inherit pkgs modules baseModules;
modulesPath = ../modules;
- pkgs_i686 = import nixpkgs { system = "i686-linux"; };
+ pkgs_i686 = import <nixpkgs> { system = "i686-linux"; };
};
# Import Nixpkgs, allowing the NixOS option nixpkgs.config to
@@ -47,15 +46,15 @@
pkgs =
if pkgs_ != null
then pkgs_
- else import nixpkgs (
+ else import <nixpkgs> (
let
system = if nixpkgsOptions.system != "" then nixpkgsOptions.system
else system_;
nixpkgsOptions = (import ./eval-config.nix {
- inherit system nixpkgs extraArgs modules;
+ inherit system extraArgs modules;
# For efficiency, leave out most NixOS modules; they don't
# define nixpkgs.config, so it's pointless to evaluate them.
baseModules = [ ../modules/misc/nixpkgs.nix ];
- pkgs = import nixpkgs { system = system_; config = {}; };
+ pkgs = import <nixpkgs> { system = system_; config = {}; };
}).optionDefinitions.nixpkgs;
in
{
Modified: nixos/trunk/lib/testing.nix
==============================================================================
--- nixos/trunk/lib/testing.nix Fri Mar 2 12:36:07 2012 (r32738)
+++ nixos/trunk/lib/testing.nix Fri Mar 2 12:38:22 2012 (r32739)
@@ -1,6 +1,6 @@
-{ nixpkgs, system }:
+{ system }:
-with import ./build-vms.nix { inherit nixpkgs system; };
+with import ./build-vms.nix { inherit system; };
with pkgs;
rec {
@@ -118,7 +118,7 @@
makeTests = testsFun: lib.mapAttrs (name: complete) (call testsFun);
apply = makeTest; # compatibility
- call = f: f { inherit pkgs nixpkgs system; };
+ call = f: f { inherit pkgs system; };
complete = t: t // rec {
nodes = buildVirtualNetwork (
Modified: nixos/trunk/maintainers/option-usages.nix
==============================================================================
--- nixos/trunk/maintainers/option-usages.nix Fri Mar 2 12:36:07 2012
(r32738)
+++ nixos/trunk/maintainers/option-usages.nix Fri Mar 2 12:38:22 2012
(r32739)
@@ -1,4 +1,4 @@
-{ configuration ? import ../lib/from-env.nix "NIXOS_CONFIG"
/etc/nixos/configuration.nix
+{ configuration ? import ../lib/from-env.nix "NIXOS_CONFIG" <nixos-config>
# []: display all options
# [<option names>]: display the selected options
Modified: nixos/trunk/modules/installer/tools/nixos-build-vms/build-vms.nix
==============================================================================
--- nixos/trunk/modules/installer/tools/nixos-build-vms/build-vms.nix Fri Mar
2 12:36:07 2012 (r32738)
+++ nixos/trunk/modules/installer/tools/nixos-build-vms/build-vms.nix Fri Mar
2 12:38:22 2012 (r32739)
@@ -1,10 +1,9 @@
-{ nixpkgs
-, system ? builtins.currentSystem
+{ system ? builtins.currentSystem
, networkExpr
}:
let nodes = import networkExpr; in
-with import ../../../../lib/testing.nix { inherit nixpkgs system; };
+with import ../../../../lib/testing.nix { inherit system; };
(complete { inherit nodes; testScript = ""; }).driver
Modified: nixos/trunk/modules/installer/tools/nixos-build-vms/nixos-build-vms.sh
==============================================================================
--- nixos/trunk/modules/installer/tools/nixos-build-vms/nixos-build-vms.sh
Fri Mar 2 12:36:07 2012 (r32738)
+++ nixos/trunk/modules/installer/tools/nixos-build-vms/nixos-build-vms.sh
Fri Mar 2 12:38:22 2012 (r32739)
@@ -58,5 +58,5 @@
# Build a network of VMs
-nix-build
${NIXOS:-/etc/nixos/nixos}/modules/installer/tools/nixos-build-vms/build-vms.nix
\
- --argstr networkExpr $networkExpr --argstr nixpkgs
"${NIXPKGS_ALL:-/etc/nixos/nixpkgs}" $noOutLinkArg $showTraceArg
+nix-build '<nixos>/modules/installer/tools/nixos-build-vms/build-vms.nix' \
+ --argstr networkExpr $networkExpr $noOutLinkArg $showTraceArg
Modified: nixos/trunk/modules/installer/tools/nixos-install.sh
==============================================================================
--- nixos/trunk/modules/installer/tools/nixos-install.sh Fri Mar 2
12:36:07 2012 (r32738)
+++ nixos/trunk/modules/installer/tools/nixos-install.sh Fri Mar 2
12:38:22 2012 (r32739)
@@ -15,10 +15,6 @@
mountPoint=/mnt
fi
-if test -z "$NIXOS"; then
- NIXOS=/etc/nixos/nixos
-fi
-
# NIXOS_CONFIG is interpreted relative to $mountPoint.
if test -z "$NIXOS_CONFIG"; then
NIXOS_CONFIG=/etc/nixos/configuration.nix
@@ -34,20 +30,12 @@
exit 1
fi
-if ! test -e "$NIXOS"; then
- echo "NixOS source directory $NIXOS doesn't exist"
- exit 1
-fi
-
if ! test -e "$mountPoint/$NIXOS_CONFIG"; then
echo "configuration file $mountPoint/$NIXOS_CONFIG doesn't exist"
exit 1
fi
-NIXOS=$(readlink -f "$NIXOS")
-
-
# Enable networking in the chroot.
mkdir -m 0755 -p $mountPoint/etc
touch /etc/resolv.conf
@@ -153,10 +141,9 @@
# Build the specified Nix expression in the target store and install
# it into the system configuration profile.
echo "building the system configuration..."
-NIXPKGS=/mnt/etc/nixos/nixpkgs chroot $mountPoint @nix@/bin/nix-env \
- -p /nix/var/nix/profiles/system \
- -f "/mnt$NIXOS" \
- --set -A system
+NIX_PATH=nixpkgs=/mnt/etc/nixos/nixpkgs:nixos=/mnt/etc/nixos/nixos \
+ chroot $mountPoint @nix@/bin/nix-env \
+ -p /nix/var/nix/profiles/system -f '<nixos>' --set -A system
# Make a backup of the old NixOS/Nixpkgs sources.
@@ -176,8 +163,8 @@
# Copy the NixOS/Nixpkgs sources to the target.
-cp -prd $NIXOS $targetNixos
-if test -e /etc/nixos/nixpkgs; then
+cp -prd /etc/nixos/nixos $targetNixos
+if [ -e /etc/nixos/nixpkgs ]; then
cp -prd /etc/nixos/nixpkgs $targetNixpkgs
fi
Modified: nixos/trunk/modules/installer/tools/nixos-option.sh
==============================================================================
--- nixos/trunk/modules/installer/tools/nixos-option.sh Fri Mar 2 12:36:07
2012 (r32738)
+++ nixos/trunk/modules/installer/tools/nixos-option.sh Fri Mar 2 12:38:22
2012 (r32739)
@@ -4,10 +4,7 @@
# file to be overridden.
: ${mountPoint=/mnt}
-: ${NIXOS=/etc/nixos/nixos}
: ${NIXOS_CONFIG=/etc/nixos/configuration.nix}
-: ${NIXPKGS=/etc/nixos/nixpkgs}
-export NIXOS
usage () {
echo 1>&2 "
@@ -38,9 +35,7 @@
Environment variables affecting $0:
\$mountPoint Path to the target file system.
- \$NIXOS Path where the NixOS repository is located.
\$NIXOS_CONFIG Path to your configuration file.
- \$NIXPKGS Path to Nix packages.
"
@@ -190,12 +185,6 @@
}
if $install; then
- if test -e "$mountPoint$NIXOS"; then
- export NIXOS="$mountPoint$NIXOS"
- fi
- if test -e "$mountPoint$NIXPKGS"; then
- export NIXPKGS="$mountPoint$NIXPKGS"
- fi
export NIXOS_CONFIG="$mountPoint$NIXOS_CONFIG"
fi
@@ -319,8 +308,8 @@
evalNix --xml --no-location <<EOF
let
reach = attrs: attrs${option:+.$option};
- nixos = import $NIXOS {};
- nixpkgs = import $NIXPKGS {};
+ nixos = <nixos>;
+ nixpkgs = <nixpkgs>;
sources = builtins.map (f: f.source);
opt = reach nixos.eval.options;
cfg = reach nixos.config;
Modified: nixos/trunk/modules/installer/tools/nixos-rebuild.sh
==============================================================================
--- nixos/trunk/modules/installer/tools/nixos-rebuild.sh Fri Mar 2
12:36:07 2012 (r32738)
+++ nixos/trunk/modules/installer/tools/nixos-rebuild.sh Fri Mar 2
12:38:22 2012 (r32739)
@@ -1,12 +1,5 @@
#! @shell@ -e
-# Allow the location of NixOS sources and the system configuration
-# file to be overridden.
-NIXOS=${NIXOS:-/etc/nixos/nixos}
-NIXPKGS=${NIXPKGS:-/etc/nixos/nixpkgs}
-NIXOS_CONFIG=${NIXOS_CONFIG:-/etc/nixos/configuration.nix}
-export NIXPKGS # must be exported so that a non default location is passed to
nixos/default.nix
-
showSyntax() {
# !!! more or less cut&paste from
# system/switch-to-configuration.sh (which we call, of course).
@@ -45,8 +38,7 @@
Environment variables affecting nixos-rebuild:
- \$NIXOS path to the NixOS source tree
- \$NIXPKGS path to the Nixpkgs source tree
+ \$NIX_PATH Nix expression search path
\$NIXOS_CONFIG path to the NixOS system configuration specification
EOF
exit 1
@@ -130,7 +122,7 @@
# Pull the manifests defined in the configuration (the "manifests"
# attribute). Wonderfully hacky.
if test -n "$pullManifest"; then
- manifests=$(nix-instantiate --eval-only --xml --strict $NIXOS -A manifests
\
+ manifests=$(nix-instantiate --eval-only --xml --strict '<nixos>' -A
manifests \
| grep '<string' | sed 's^.*"\(.*\)".*^\1^g')
mkdir -p /nix/var/nix/channel-cache
@@ -147,9 +139,9 @@
# more conservative.
if test -n "$buildNix"; then
echo "building Nix..." >&2
- if ! nix-build $NIXOS -A config.environment.nix -o $tmpDir/nix
$extraBuildFlags > /dev/null; then
- if ! nix-build $NIXOS -A nixFallback -o $tmpDir/nix $extraBuildFlags >
/dev/null; then
- nix-build $NIXPKGS -A nixUnstable -o $tmpDir/nix $extraBuildFlags
> /dev/null
+ if ! nix-build '<nixos>' -A config.environment.nix -o $tmpDir/nix
$extraBuildFlags > /dev/null; then
+ if ! nix-build '<nixos>' -A nixFallback -o $tmpDir/nix
$extraBuildFlags > /dev/null; then
+ nix-build '<nixpkgs>' -A nixUnstable -o $tmpDir/nix
$extraBuildFlags > /dev/null
fi
fi
PATH=$tmpDir/nix/bin:$PATH
@@ -162,16 +154,16 @@
if test -z "$rollback"; then
echo "building the system configuration..." >&2
if test "$action" = switch -o "$action" = boot; then
- nix-env -p /nix/var/nix/profiles/system -f $NIXOS --set -A system
$extraBuildFlags
+ nix-env -p /nix/var/nix/profiles/system -f '<nixos>' --set -A system
$extraBuildFlags
pathToConfig=/nix/var/nix/profiles/system
elif test "$action" = test -o "$action" = build -o "$action" = dry-run;
then
- nix-build $NIXOS -A system -K -k $extraBuildFlags > /dev/null
+ nix-build '<nixos>' -A system -K -k $extraBuildFlags > /dev/null
pathToConfig=./result
elif [ "$action" = build-vm ]; then
- nix-build $NIXOS -A vm -K -k $extraBuildFlags > /dev/null
+ nix-build '<nixos>' -A vm -K -k $extraBuildFlags > /dev/null
pathToConfig=./result
elif [ "$action" = build-vm-with-bootloader ]; then
- nix-build $NIXOS -A vmWithBootLoader -K -k $extraBuildFlags > /dev/null
+ nix-build '<nixos>' -A vmWithBootLoader -K -k $extraBuildFlags >
/dev/null
pathToConfig=./result
else
showSyntax
Modified: nixos/trunk/modules/programs/bash/profile.sh
==============================================================================
--- nixos/trunk/modules/programs/bash/profile.sh Fri Mar 2 12:36:07
2012 (r32738)
+++ nixos/trunk/modules/programs/bash/profile.sh Fri Mar 2 12:38:22
2012 (r32739)
@@ -10,7 +10,6 @@
export
LD_LIBRARY_PATH=/var/run/opengl-driver/lib:/var/run/opengl-driver-32/lib # !!!
only set if needed
export MODULE_DIR=@modulesTree@/lib/modules
export NIXPKGS_CONFIG=/nix/etc/config.nix
-export NIXPKGS_ALL=/etc/nixos/nixpkgs
export
NIX_PATH=nixpkgs=/etc/nixos/nixpkgs:nixos=/etc/nixos/nixos:nixos-config=/etc/nixos/configuration.nix:services=/etc/nixos/services
export PAGER="less -R"
export EDITOR=nano
Modified: nixos/trunk/tests/default.nix
==============================================================================
--- nixos/trunk/tests/default.nix Fri Mar 2 12:36:07 2012 (r32738)
+++ nixos/trunk/tests/default.nix Fri Mar 2 12:38:22 2012 (r32739)
@@ -1,8 +1,6 @@
-{ nixpkgs ? ../../nixpkgs
-, system ? builtins.currentSystem
-}:
+{ system ? builtins.currentSystem }:
-with import ../lib/testing.nix { inherit nixpkgs system; };
+with import ../lib/testing.nix { inherit system; };
{
avahi = makeTest (import ./avahi.nix);
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits