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

installer: add --check flag

This commit is contained in:
Daiderd Jordan 2018-01-13 21:17:29 +01:00
parent 32481b542b
commit 9dd2d679cb
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -24,6 +24,20 @@ stdenv.mkDerivation {
#!/usr/bin/env bash
set -e
action=switch
while [ "$#" -gt 0 ]; do
i="$1"; shift 1
case "$i" in
--help)
echo "darwin-installer: [--check]"
exit
;;
--check)
action=check
;;
esac
done
export nix=${nix}
config=$(nix-instantiate --eval -E '<darwin-config>' 2> /dev/null || echo "$HOME/.nixpkgs/darwin-configuration.nix")
@ -37,7 +51,7 @@ stdenv.mkDerivation {
system=$($nix/bin/nix-build '<darwin>' -I "user-darwin-config=$config" -A system --no-out-link)
export PATH=$system/sw/bin:$PATH
darwin-rebuild switch -I "user-darwin-config=$config"
darwin-rebuild "$action" -I "user-darwin-config=$config"
echo >&2
echo " Open '$config' to get started." >&2