1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

darwin-rebuild: add --list-generations flag

This commit is contained in:
Daiderd Jordan 2017-10-20 21:45:31 +02:00
parent 78d426940a
commit 6ea3f405e8
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -6,10 +6,11 @@ export PATH=@path@:$PATH
showSyntax() { showSyntax() {
echo "darwin-rebuild [--help] {build | switch | check | changelog}" >&2 echo "darwin-rebuild [--help] {build | switch | check | changelog}" >&2
echo " [{--profile-name | -p} name] [{--switch-generation | -G} generation] [--rollback]" >&1 echo " [--list-generations] [{--profile-name | -p} name] [--rollback]" >&2
echo " [--verbose...] [-v...] [-Q] [{--max-jobs | -j} number] [--cores number]" >&2 echo " [{--switch-generation | -G} generation] [--verbose...] [-v...]" >&2
echo " [--dry-run] [--keep-going] [-k] [--keep-failed] [-K] [--fallback] [--show-trace] [-I path]" >&2 echo " [-Q] [{--max-jobs | -j} number] [--cores number] [--dry-run]" >&1
echo " [--option name value] [--arg name value] [--argstr name value]" >&2 echo " [--keep-going] [-k] [--keep-failed] [-K] [--fallback] [--show-trace]" >&2
echo " [-I path] [--option name value] [--arg name value] [--argstr name value]" >&2
exec man darwin-rebuild exec man darwin-rebuild
exit 1 exit 1
} }
@ -53,6 +54,10 @@ while [ "$#" -gt 0 ]; do
k="$1"; shift 1 k="$1"; shift 1
extraBuildFlags+=("$i" "$j" "$k") extraBuildFlags+=("$i" "$j" "$k")
;; ;;
--list-generations)
action="list"
extraProfileFlags=("$i")
;;
--rollback) --rollback)
action="rollback" action="rollback"
extraProfileFlags=("$i") extraProfileFlags=("$i")
@ -90,12 +95,12 @@ if ! [ "$action" = build ]; then
extraBuildFlags+=("--no-out-link") extraBuildFlags+=("--no-out-link")
fi fi
echo "building the system configuration..." >&2 if ! [ "$action" = list -o "$action" = rollback ]; then
if ! [ "$action" = rollback ]; then echo "building the system configuration..." >&2
systemConfig="$(nix-build '<darwin>' ${extraBuildFlags[@]} -A system)" systemConfig="$(nix-build '<darwin>' ${extraBuildFlags[@]} -A system)"
fi fi
if [ "$action" = rollback ]; then if [ "$action" = list -o "$action" = rollback ]; then
if [ "$USER" != root -a ! -w $(dirname "$profile") ]; then if [ "$USER" != root -a ! -w $(dirname "$profile") ]; then
sudo nix-env -p $profile ${extraProfileFlags[@]} sudo nix-env -p $profile ${extraProfileFlags[@]}
else else