summary refs log tree commit diff
path: root/build.sh
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-12-12 00:27:37 +0100
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-12-12 00:27:37 +0100
commitfb581407fe0a996a8619cdbe74cb0dda0dbb8194 (patch)
treeff3e0e608945b01183b4eb3df34b7464ce7ca647 /build.sh
parentInclude hardware config (diff)
downloadRory-Open-Architecture-fb581407fe0a996a8619cdbe74cb0dda0dbb8194.tar.xz
Add wrapper script
Signed-off-by: TheArcaneBrony <myrainbowdash949@gmail.com>
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..1fdf453
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env sh
+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
+    exit 1
+fi
+if [ "$1" = "/" ]; then
+    nixos-generate-config --show-hardware-config > hardware-configuration.nix
+    nixos-rebuild --flake ".#${2}" build
+    exit 1
+else
+    nixos-generate-config --show-hardware-config > hardware-configuration.nix
+    nixos-install --root "${1}" --flake ".#${2}" 
+    exit 1
+fi