fixing install.sh

This commit is contained in:
Bernardo Magri
2026-04-10 20:28:54 +01:00
parent 9f62f0f5f1
commit 769fd88f25

View File

@@ -1,32 +1,27 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -e set -e
# Ensure flakes are enabled for the script's execution environment # --- BULLETPROOF WRAPPERS FOR BAREBONES NIXOS ---
export NIX_CONFIG="experimental-features = nix-command flakes" # We explicitly invoke nix run with experimental features enabled
# for every external tool so it never relies on global configurations.
# Define a safe wrapper for gum using arrays to prevent word-splitting bugs
gum() { gum() {
local cmd="$1" local cmd="$1"
shift # Redirect TTY for interactive commands so it works even if piped via curl
local gum_exec
if command -v gum >/dev/null 2>&1; then
gum_exec=(command gum)
else
# Use --quiet to avoid progress bars in captured output
gum_exec=(nix run --quiet nixpkgs#gum --)
fi
case "$cmd" in case "$cmd" in
input|confirm|choose|filter|write) input|confirm|choose|filter|write)
"${gum_exec[@]}" "$cmd" "$@" < /dev/tty nix run --quiet --extra-experimental-features "nix-command flakes" nixpkgs#gum -- "$@" < /dev/tty
;; ;;
*) *)
"${gum_exec[@]}" "$cmd" "$@" nix run --quiet --extra-experimental-features "nix-command flakes" nixpkgs#gum -- "$@"
;; ;;
esac esac
} }
nix_git() {
nix run --quiet --extra-experimental-features "nix-command flakes" nixpkgs#git -- "$@"
}
clear clear
# --- TITLE SCREEN --- # --- TITLE SCREEN ---
@@ -132,10 +127,9 @@ EOF
gum style --foreground 120 " ✔ Generated unified flake.nix and sub-modules" gum style --foreground 120 " ✔ Generated unified flake.nix and sub-modules"
# --- STEP 4: VERSION CONTROL --- # --- STEP 4: VERSION CONTROL ---
# Wrapped in a spinner for a cleaner look
gum spin --spinner dot --title " Initializing Version Control..." -- bash -c " gum spin --spinner dot --title " Initializing Version Control..." -- bash -c "
nix run nixpkgs#git -- -C \"$LOCAL_DIR\" init > /dev/null 2>&1 nix run --quiet --extra-experimental-features 'nix-command flakes' nixpkgs#git -- -C \"$LOCAL_DIR\" init > /dev/null 2>&1
nix run nixpkgs#git -- -C \"$LOCAL_DIR\" add . > /dev/null 2>&1 nix run --quiet --extra-experimental-features 'nix-command flakes' nixpkgs#git -- -C \"$LOCAL_DIR\" add . > /dev/null 2>&1
" "
gum style --foreground 120 " ✔ Version control active" gum style --foreground 120 " ✔ Version control active"
echo "" echo ""
@@ -149,12 +143,11 @@ gum style \
if gum confirm "Build Nomarchy OS now?"; then if gum confirm "Build Nomarchy OS now?"; then
echo "" echo ""
# Run builds with a spinner to hide the massive text dump
gum spin --spinner line --title " Compiling System Engine (Requires Sudo)..." -- \ gum spin --spinner line --title " Compiling System Engine (Requires Sudo)..." -- \
sudo nixos-rebuild switch --flake "$LOCAL_DIR#$HOSTNAME" --extra-experimental-features "nix-command flakes" sudo nixos-rebuild switch --flake "$LOCAL_DIR#$HOSTNAME" --extra-experimental-features "nix-command flakes"
gum spin --spinner line --title " Building User Interface..." -- \ gum spin --spinner line --title " Building User Interface..." -- \
nix run home-manager/release-25.11 -- switch --flake "$LOCAL_DIR#$USERNAME" nix run --extra-experimental-features "nix-command flakes" home-manager/release-25.11 -- switch --flake "$LOCAL_DIR#$USERNAME"
clear clear
gum style \ gum style \