From 97252ffce488a0a705775c436437c4962bc6aa28 Mon Sep 17 00:00:00 2001
From: Qubasa <consulting@qube.email>
Date: Mon, 20 Jan 2025 22:02:00 +0700
Subject: [PATCH] --debug enables --show-trace on nix build commands

---
 src/nixos-anywhere.sh | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/nixos-anywhere.sh b/src/nixos-anywhere.sh
index fed359fa..db646395 100755
--- a/src/nixos-anywhere.sh
+++ b/src/nixos-anywhere.sh
@@ -7,6 +7,7 @@ flakeAttr=""
 kexecUrl=""
 kexecExtraFlags=""
 enableDebug=""
+nixBuildFlags=""
 diskoScript=""
 diskoMode="disko"
 nixosSystem=""
@@ -215,6 +216,7 @@ parseArgs() {
     --debug)
       enableDebug="-x"
       printBuildLogs=y
+      nixBuildFlags="--show-trace"
       set -x
       ;;
     --disko-mode)
@@ -353,6 +355,7 @@ nixBuild() {
   NIX_SSHOPTS="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i $sshKeyDir/nixos-anywhere ${sshArgs[*]}" nix build \
     --print-out-paths \
     --no-link \
+    $nixBuildFlags \
     "${nixOptions[@]}" \
     "$@"
 }
@@ -380,6 +383,7 @@ runVmTest() {
     --print-out-paths \
     --no-link \
     -L \
+    $nixBuildFlags \
     "${nixOptions[@]}" \
     "${flake}#${flakeAttr}.system.build.installTest"
 }