diff options
author | Nicolas B. Pierron <nicolas.b.pierron@gmail.com> | 2014-12-21 15:11:11 -0800 |
---|---|---|
committer | Nicolas B. Pierron <nicolas.b.pierron@gmail.com> | 2014-12-21 15:11:11 -0800 |
commit | 6a7971bee73a560b6cb5ced97bbe364b01e3cd6d (patch) | |
tree | 34e552176a3e040376609f6af4727db649e1249b /nixos/modules/installer | |
parent | e4fb4168fce77044aa896834eb3fedd6e03ee795 (diff) | |
parent | 82a5f54c0de9bcdd01a6c7971fdd73e98c2738cb (diff) | |
download | nixlib-6a7971bee73a560b6cb5ced97bbe364b01e3cd6d.tar nixlib-6a7971bee73a560b6cb5ced97bbe364b01e3cd6d.tar.gz nixlib-6a7971bee73a560b6cb5ced97bbe364b01e3cd6d.tar.bz2 nixlib-6a7971bee73a560b6cb5ced97bbe364b01e3cd6d.tar.lz nixlib-6a7971bee73a560b6cb5ced97bbe364b01e3cd6d.tar.xz nixlib-6a7971bee73a560b6cb5ced97bbe364b01e3cd6d.tar.zst nixlib-6a7971bee73a560b6cb5ced97bbe364b01e3cd6d.zip |
Merge pull request #5416 from nbp/nixos-option-include
nixos-option: Support -I option
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r-- | nixos/modules/installer/tools/nixos-option.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/nixos/modules/installer/tools/nixos-option.sh b/nixos/modules/installer/tools/nixos-option.sh index 3016536ecddf..17c17d05e288 100644 --- a/nixos/modules/installer/tools/nixos-option.sh +++ b/nixos/modules/installer/tools/nixos-option.sh @@ -13,6 +13,7 @@ usage () { xml=false verbose=false +nixPath="" option="" @@ -26,6 +27,7 @@ for arg; do while test "$sarg" != "-"; do case $sarg in --*) longarg=$arg; sarg="--";; + -I) argfun="include_nixpath";; -*) usage;; esac # remove the first letter option @@ -53,6 +55,9 @@ for arg; do var=$(echo $argfun | sed 's,^set_,,') eval $var=$arg ;; + include_nixpath) + nixPath="-I $arg $nixPath" + ;; esac argfun="" fi @@ -69,14 +74,17 @@ fi ############################# evalNix(){ - result=$(nix-instantiate - --eval-only "$@" 2>&1) + result=$(nix-instantiate ${nixPath:+$nixPath} - --eval-only "$@" 2>&1) if test $? -eq 0; then cat <<EOF $result EOF return 0; else - sed -n '/error/ { s/, at (string):[0-9]*:[0-9]*//; p; }' <<EOF + sed -n ' + /^error/ { s/, at (string):[0-9]*:[0-9]*//; p; }; + /^warning: Nix search path/ { p; }; +' <<EOF $result EOF return 1; |