1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-13 20:30:02 +00:00

nix-script: add nix-env operations

This commit is contained in:
Daiderd Jordan 2017-01-20 23:31:42 +01:00
parent fc900c0eeb
commit 40eb4254d5
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

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