1
0
dotfiles/bin/darwin-build
Jip J. Dekker 4363d1a7d4 Initial Commit
Add flake template from dustinlyons/nixos-config
2023-12-11 17:35:39 +11:00

28 lines
573 B
Bash
Executable File

#!/bin/sh -e
VERSION=1.0
GREEN='\033[1;32m'
RED='\033[1;31m'
NC='\033[0m'
FLAKE="macos"
SYSTEM="darwinConfigurations.$FLAKE.system"
export NIXPKGS_ALLOW_UNFREE=1
# Navigate to the directory of this script
cd $(dirname $(readlink -f $0))
cd ..
echo "${GREEN}Starting build...${NC}"
nix --experimental-features 'nix-command flakes' build .#$SYSTEM $@
echo "${GREEN}Switching to new generation...${NC}"
./result/sw/bin/darwin-rebuild switch --flake .#$FLAKE $@
echo "${GREEN}Cleaning up...${NC}"
unlink ./result
echo "${GREEN}Switch to new generation complete!${NC}"