-
Notifications
You must be signed in to change notification settings - Fork 80
/
darwin-build
executable file
·36 lines (25 loc) · 1.04 KB
/
darwin-build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh -e
VERSION=1.0
GREEN='\033[1;32m'
RED='\033[1;31m'
CLEAR='\033[0m'
FLAKE="Dustins-MBP"
SYSTEM="darwinConfigurations.$FLAKE.system"
export NIXPKGS_ALLOW_UNFREE=1
# Navigate to the directory of this script
cd $(dirname $(readlink -f $0))
cd ..
echo "${GREEN}Requesting sudo to set homebrew tap permissions...${CLEAR}"
# Check if the directory exists before running chmod
if [ -d "/opt/homebrew/Library/Taps" ]; then
sudo /bin/chmod +a "dustin allow list,add_file,search,delete,add_subdirectory,delete_child,readattr,writeattr,readextattr,writeextattr,readsecurity,writesecurity,chown" /opt/homebrew/Library/Taps/homebrew/
else
echo "${RED}The directory /opt/homebrew/Library/Taps/homebrew/ does not exist. Skipping chmod.${CLEAR}"
fi
echo "${GREEN}Starting build...${CLEAR}"
nix --experimental-features 'nix-command flakes' build .#$SYSTEM $@
echo "${GREEN}Switching to new generation...${CLEAR}"
./result/sw/bin/darwin-rebuild switch --flake .#$FLAKE $@
echo "${GREEN}Cleaning up...${CLEAR}"
unlink ./result
echo "${GREEN}Done${CLEAR}"