diff options
author | Rory& <root@rory.gay> | 2023-10-04 23:14:58 +0200 |
---|---|---|
committer | Rory& <root@rory.gay> | 2023-10-04 23:14:58 +0200 |
commit | 42bc49d716919c8311ac70a7808156494eb5de42 (patch) | |
tree | 216f722b63377097dcc6f3fd7557bfdc989064c4 /build.sh | |
parent | Update WSL (diff) | |
download | Rory-Open-Architecture-42bc49d716919c8311ac70a7808156494eb5de42.tar.xz |
Improvements
Diffstat (limited to 'build.sh')
-rwxr-xr-x | build.sh | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/build.sh b/build.sh index 070b847..dcf7787 100755 --- a/build.sh +++ b/build.sh @@ -1,15 +1,17 @@ -#!/usr/bin/env sh +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p git nixos-install-tools if [ $# -ne 2 ]; then echo "Usage: $0 <root> <config>" echo "NOTE: hardware config will be generated from root!" echo "Defined configs:" - cat flake.nix | grep 'nixpkgs.lib.nixosSystem' | sed 's/ =.*//' | sed 's/^[ \t]*//;s/[ \t]*$//' | while read cfg; do echo " - $cfg"; done + cat flake.nix | grep '.lib.nixosSystem' | sed 's/ =.*//' | sed 's/^[ \t]*//;s/[ \t]*$//' | while read cfg; do echo " - $cfg"; done exit 1 fi if [ "$1" = "/" ]; then [ -f "host/${2}/pre-rebuild.sh" ] && host/$2/pre-rebuild.sh nixos-generate-config --show-hardware-config > hardware-configuration.nix git add -f hardware-configuration.nix + nom build .#nixosConfigurations.${2}.config.system.build.toplevel && sudo nixos-rebuild switch --flake .#${HOSTNAME} || exit 1 nixos-rebuild switch --flake ".#${2}" -j`nproc` --upgrade-all -L || exit 1 [ -f "host/${2}/post-rebuild.sh" ] && host/$2/post-rebuild.sh git rm --cached hardware-configuration.nix @@ -17,6 +19,7 @@ if [ "$1" = "/" ]; then else nixos-generate-config --show-hardware-config --root "${1}" > hardware-configuration.nix git add -f hardware-configuration.nix + nom build .#nixosConfigurations.${2}.config.system.build.toplevel || exit 1 nixos-install --root "${1}" --flake ".#${2}" git rm --cached hardware-configuration.nix cp . "${1}/Rory-Open-Architecture" -r |