summaryrefslogtreecommitdiff
path: root/pkgs
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2017-01-20 23:31:42 +0100
committerDaiderd Jordan <daiderd@gmail.com>2017-01-20 23:31:42 +0100
commit40eb4254d548ef79398ef4335bdd0ed960d9e995 (patch)
tree049ce89027d67272fa663477c02124822ae25cfe /pkgs
parentfc900c0eebfba47aa4158b82b9df7af6cd7d0c52 (diff)
nix-script: add nix-env operations
Diffstat (limited to 'pkgs')
-rwxr-xr-xpkgs/nix-tools/nix-script.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkgs/nix-tools/nix-script.sh b/pkgs/nix-tools/nix-script.sh
index 3f5e0f5..a0a5793 100755
--- a/pkgs/nix-tools/nix-script.sh
+++ b/pkgs/nix-tools/nix-script.sh
@@ -12,6 +12,7 @@ showUsage() {
echo " {h | hash}" >&2
echo " {store | q | query | r | realise | gc | add | delete}" >&2
echo " {repl}" >&2
+ echo " {-q | -i | -e | -u}" >&2
exit ${@:-1}
}
@@ -88,6 +89,20 @@ while [ "$#" -gt 0 ]; do
repl)
action='repl'
;;
+ -q)
+ action='env'
+ extraNixFlags+=("$i")
+ ;;
+ -iA|-i|-e|-u)
+ action='env'
+ extraNixFlags+=("$i")
+ if [ -z "$1" ]; then
+ echo "$0: \`$i' requires an argument"
+ exit 1
+ fi
+ j="$1"; shift 1
+ extraNixFlags+=("$i" "$j")
+ ;;
--add-root)
# nix-instantiate
if [ -z "$1" ]; then
@@ -239,6 +254,10 @@ if [ "$action" = store ]; then
exec nix-store ${srcArgs[@]} ${extraNixFlags[@]}
fi
+if [ "$action" = env ]; then
+ exec nix-env -f '<nixpkgs>' ${extraNixFlags[@]}
+fi
+
if [ "$action" = repl ]; then
exec nix-repl '<nixpkgs/lib>' ${pkgArgs[@]} ${srcArgs[@]}
fi