dotfiles/nix-darwin.sh
2022-08-11 15:27:25 -04:00

30 lines
690 B
Bash
Executable File

#!/usr/bin/env bash
set -uo pipefail
cd $(dirname "$0")
# setup defaults
config=${config:-jeremys-mbp}
extraOpts=()
# we need to select the correct configuration item via argument.
while [ $# -gt 0 ]; do
i=$1; shift 1
case $i in
--config)
if [ $# -lt 1 ]; then
echo "$0: '$i' requires an argument"
exit 1
fi
config="$1"; shift 1
;;
--show-trace)
extraOpts+=("$1")
esac
done
# Build the system configuration
nix --experimental-features "nix-command flakes" \
build --show-trace ./nix/darwin#darwinConfigurations.${config}.system
# move to profile and activate it
darwin-rebuild --show-trace build ./nix/darwin#${config}