about summary refs log tree commit diff
path: root/bin/update.sh
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2023-11-06 16:49:25 -0800
committerFranck Cuny <franck@fcuny.net>2023-11-06 17:05:04 -0800
commit7180c50b71efa564e55d4997bf9787f39b579b82 (patch)
tree0bf409a63b66c3bd622968c0904fdce87c659d40 /bin/update.sh
parentinstall a few more CLI (diff)
downloadworld-7180c50b71efa564e55d4997bf9787f39b579b82.tar.gz
add a script to update local machine
Diffstat (limited to 'bin/update.sh')
-rwxr-xr-xbin/update.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/bin/update.sh b/bin/update.sh
new file mode 100755
index 0000000..1949525
--- /dev/null
+++ b/bin/update.sh
@@ -0,0 +1,24 @@
+#!/bin/sh -e
+
+VERSION=1.0
+
+GREEN='\033[1;32m'
+RED='\033[1;31m'
+CLEAR='\033[0m'
+
+export NIXPKGS_ALLOW_UNFREE=1
+
+# Navigate to the directory of this script
+cd $(dirname $(readlink -f $0))
+cd ..
+
+echo "${GREEN}Starting build...${CLEAR}"
+nix --experimental-features 'nix-command flakes' build .#darwinConfigurations.$(hostname -s).system $@
+
+echo "${GREEN}Switching to new generation...${CLEAR}"
+./result/sw/bin/darwin-rebuild switch --flake .# $@
+
+echo "${GREEN}Cleaning up...${CLEAR}"
+unlink ./result
+
+echo "${GREEN}Done${CLEAR}"