fix: resolve evaluation purity, missing packages, and brittle paths

This commit is contained in:
Bernardo Magri
2026-04-13 19:50:09 +01:00
parent cabc668c77
commit d9c35f5ff6
13 changed files with 176 additions and 192 deletions

View File

@@ -32,9 +32,16 @@ ENABLE_IMPERMANENCE="false"
# UTILITY FUNCTIONS
# ============================================================================
# Helper to run commands via nix run
nrun() {
local pkg="$1"
shift
nix run --extra-experimental-features "nix-command flakes" "nixpkgs#$pkg" -- "$@"
}
header() {
clear
gum style \
nrun gum style \
--foreground 212 --border-foreground 212 --border double \
--align center --width 60 --margin "1 2" --padding "2 4" \
"NOMARCHY INSTALLER" "NixOS with Omarchy flavor"
@@ -43,20 +50,20 @@ header() {
section() {
echo ""
gum style --foreground 14 --bold "━━━ $1 ━━━"
nrun gum style --foreground 14 --bold "━━━ $1 ━━━"
echo ""
}
success() {
gum style --foreground 10 "$1"
nrun gum style --foreground 10 "$1"
}
error() {
gum style --foreground 9 "$1"
nrun gum style --foreground 9 "$1"
}
info() {
gum style --foreground 12 "$1"
nrun gum style --foreground 12 "$1"
}
# ============================================================================
@@ -169,7 +176,7 @@ get_luks_passphrase() {
configure_user() {
section "User Configuration"
USERNAME=$(gum input --placeholder "Enter username (lowercase, no spaces)")
USERNAME=$(nrun gum input --placeholder "Enter username (lowercase, no spaces)")
if [[ -z "$USERNAME" ]] || [[ ! "$USERNAME" =~ ^[a-z][a-z0-9_-]*$ ]]; then
error "Invalid username"
exit 1
@@ -181,10 +188,10 @@ configure_user() {
info "Set a password for your user account"
local pass1 pass2
while true; do
pass1=$(gum input --password --placeholder "Enter user password")
pass1=$(nrun gum input --password --placeholder "Enter user password")
[[ -z "$pass1" ]] && continue
pass2=$(gum input --password --placeholder "Confirm user password")
pass2=$(nrun gum input --password --placeholder "Confirm user password")
if [[ "$pass1" == "$pass2" ]]; then
USER_PASSWORD="$pass1"
@@ -314,10 +321,10 @@ review_configuration() {
echo " Impermanence: $ENABLE_IMPERMANENCE"
echo ""
gum style --foreground 9 "This will DESTROY all data on $TARGET_DRIVE"
nrun gum style --foreground 9 "This will DESTROY all data on $TARGET_DRIVE"
echo ""
if ! gum confirm "Proceed with installation?"; then
if ! nrun gum confirm "Proceed with installation?"; then
error "Aborted"
exit 1
fi
@@ -359,11 +366,11 @@ execute_installation() {
info "Initializing git repository..."
(
cd /mnt/etc/nixos
git init -q
git add .
git config user.name "Nomarchy Installer"
git config user.email "installer@nomarchy"
git commit -qm "Initial Nomarchy configuration"
nrun git git init -q
nrun git git add .
nrun git git config user.name "Nomarchy Installer"
nrun git git config user.email "installer@nomarchy"
nrun git git commit -qm "Initial Nomarchy configuration"
)
success "Git repository initialized"
@@ -493,7 +500,7 @@ EOF
finish() {
header
gum style --foreground 10 --bold --align center "INSTALLATION COMPLETE!"
nrun gum style --foreground 10 --bold --align center "INSTALLATION COMPLETE!"
echo ""
echo "Nomarchy has been successfully installed."
echo ""
@@ -504,7 +511,7 @@ finish() {
echo " 4. Your configuration is at /etc/nixos/"
echo ""
if gum confirm "Reboot now?"; then
if nrun gum confirm "Reboot now?"; then
reboot
fi
}
@@ -529,3 +536,7 @@ main() {
}
main "$@"
finish
}
main "$@"