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:
parent
fc900c0eeb
commit
40eb4254d5
1 changed files with 19 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue