Fix usage message (-description) and honor $NIXOS instead of $NIXOS_PATH.

svn path=/nixos/trunk/; revision=23937
This commit is contained in:
Nicolas Pierron 2010-09-26 08:43:55 +00:00
parent bf3a8dfbe4
commit 62c9591d0b

View File

@ -4,10 +4,10 @@
# file to be overridden. # file to be overridden.
: ${mountPoint=/mnt} : ${mountPoint=/mnt}
: ${NIXOS_PATH=/etc/nixos/nixos} : ${NIXOS=/etc/nixos/nixos}
: ${NIXOS_CONFIG=/etc/nixos/configuration.nix} : ${NIXOS_CONFIG=/etc/nixos/configuration.nix}
: ${NIXPKGS=/etc/nixos/nixpkgs} : ${NIXPKGS=/etc/nixos/nixpkgs}
export NIXOS_PATH export NIXOS
usage () { usage () {
echo 1>&2 " echo 1>&2 "
@ -15,8 +15,8 @@ Usage: $0 [--install] [-v] [-d] [-l] OPTION_NAME
$0 [--install] $0 [--install]
This program is used to explore NixOS options by looking at their values or This program is used to explore NixOS options by looking at their values or
by looking at their description. It is helpful for understanding the how by looking at their description. It is helpful for understanding how your
your configuration is working. configuration is working.
Options: Options:
@ -27,7 +27,7 @@ Options:
specified. specified.
-v | --value Display the current value, based on your -v | --value Display the current value, based on your
configuration. configuration.
-d | --default Display the default value, the example and the -d | --description Display the default value, the example and the
description. description.
-l | --lookup Display where the option is defined and where it -l | --lookup Display where the option is defined and where it
is declared. is declared.
@ -36,7 +36,7 @@ Options:
Environment variables affecting $0: Environment variables affecting $0:
\$mountPoint Path to the target file system. \$mountPoint Path to the target file system.
\$NIXOS_PATH Path where the NixOS repository is located. \$NIXOS Path where the NixOS repository is located.
\$NIXOS_CONFIG Path to your configuration file. \$NIXOS_CONFIG Path to your configuration file.
\$NIXPKGS Path to Nix packages. \$NIXPKGS Path to Nix packages.
@ -133,7 +133,7 @@ evalAttr(){
local prefix=$1 local prefix=$1
local suffix=$2 local suffix=$2
local strict=$3 local strict=$3
echo "(import $NIXOS_PATH {}).$prefix${option:+.$option}${suffix:+.$suffix}" | echo "(import $NIXOS {}).$prefix${option:+.$option}${suffix:+.$suffix}" |
nix-instantiate - --eval-only ${strict:+--strict} nix-instantiate - --eval-only ${strict:+--strict}
} }
@ -147,13 +147,13 @@ evalCfg(){
findSources(){ findSources(){
local suffix=$1 local suffix=$1
echo "builtins.map (f: f.source) (import $NIXOS_PATH {}).eval.options${option:+.$option}.$suffix" | echo "builtins.map (f: f.source) (import $NIXOS {}).eval.options${option:+.$option}.$suffix" |
nix-instantiate - --eval-only --strict nix-instantiate - --eval-only --strict
} }
if $install; then if $install; then
if test -e "$mountPoint$NIXOS_PATH"; then if test -e "$mountPoint$NIXOS"; then
export NIXOS_PATH="$mountPoint$NIXOS_PATH" export NIXOS="$mountPoint$NIXOS"
fi fi
if test -e "$mountPoint$NIXPKGS"; then if test -e "$mountPoint$NIXPKGS"; then
export NIXPKGS="$mountPoint$NIXPKGS" export NIXPKGS="$mountPoint$NIXPKGS"