1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-11-13 04:56:53 +03: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