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

darwin: add --check flag

This commit is contained in:
Daiderd Jordan 2017-07-23 18:02:08 +02:00
parent e4a11b2073
commit 6d91e5b565
No known key found for this signature in database
GPG key ID: D02435D05B810C96
2 changed files with 17 additions and 2 deletions

View file

@ -67,8 +67,15 @@ in
system.activationScripts.checks.text = ''
set +e
${buildUsers}
${nixPath}
if test ''${checkActivation:-0} -eq 1; then
echo "ok" >&2
exit 0
fi
set -e
'';

View file

@ -52,6 +52,10 @@ while [ "$#" -gt 0 ]; do
k="$1"; shift 1
extraBuildFlags+=("$i" "$j" "$k")
;;
--check)
action="check"
export checkActivation=1
;;
--rollback)
action="rollback"
extraProfileFlags=("$i")
@ -85,12 +89,12 @@ done
if [ -z "$action" ]; then showSyntax; fi
if [ "$action" = switch ]; then
if [ "$action" = switch -o "$action" = check ]; then
extraBuildFlags+=("--no-out-link")
fi
echo "building the system configuration..." >&2
if [ "$action" = switch -o "$action" = build ]; then
if [ "$action" = switch -o "$action" = build -o "$action" = check ]; then
systemConfig="$(nix-build '<darwin>' ${extraBuildFlags[@]} -A system)"
fi
@ -127,3 +131,7 @@ if [ "$action" = switch -o "$action" = rollback ]; then
$systemConfig/activate
fi
fi
if [ "$action" = check ]; then
$systemConfig/activate-user
fi