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
set -e
# Ensure flakes are enabled for the script's execution environment
export NIX_CONFIG="experimental-features = nix-command flakes"
# --- BULLETPROOF WRAPPERS FOR BAREBONES NIXOS ---
# 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() {
local cmd="$1"
shift
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
# Redirect TTY for interactive commands so it works even if piped via curl
case "$cmd" in
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
}
nix_git() {
nix run --quiet --extra-experimental-features "nix-command flakes" nixpkgs#git -- "$@"
}
clear
# --- TITLE SCREEN ---
@@ -132,10 +127,9 @@ EOF
gum style --foreground 120 " ✔ Generated unified flake.nix and sub-modules"
# --- STEP 4: VERSION CONTROL ---
# Wrapped in a spinner for a cleaner look
gum spin --spinner dot --title " Initializing Version Control..." -- bash -c "
nix run 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\" init > /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"
echo ""
@@ -149,12 +143,11 @@ gum style \
if gum confirm "Build Nomarchy OS now?"; then
echo ""
# Run builds with a spinner to hide the massive text dump
gum spin --spinner line --title " Compiling System Engine (Requires Sudo)..." -- \
sudo nixos-rebuild switch --flake "$LOCAL_DIR#$HOSTNAME" --extra-experimental-features "nix-command flakes"
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
gum style \