106 lines
3.4 KiB
Bash
Executable File
106 lines
3.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -e
|
|
|
|
STATE_FILE="$HOME/.config/nomarchy/state.json"
|
|
|
|
# Check if welcome wizard has already been completed
|
|
if [ -f "$STATE_FILE" ]; then
|
|
DONE=$(jq -r '.welcome_done' "$STATE_FILE" 2>/dev/null)
|
|
if [ "$DONE" == "true" ]; then
|
|
exit 0
|
|
fi
|
|
fi
|
|
|
|
# Ensure we have a terminal for the wizard
|
|
if [ -z "$TERMINAL_WIZARD" ]; then
|
|
export TERMINAL_WIZARD=1
|
|
alacritty -e "$0"
|
|
exit 0
|
|
fi
|
|
|
|
gum style \
|
|
--foreground 212 --border-foreground 212 --border double \
|
|
--align center --width 50 --margin "1 2" --padding "2 4" \
|
|
"Nomarchy" "The Professional NixOS Desktop"
|
|
|
|
echo "Welcome! Let's personalize your new system."
|
|
echo ""
|
|
|
|
# 0. Show what the installer actually wrote so the user can verify the
|
|
# install shape (theme, font, profiles, drives, FDE, form factor) before
|
|
# diving into customisation. Available standalone via the same command.
|
|
nomarchy-installed-summary
|
|
echo ""
|
|
gum input --placeholder "Press Enter to continue with customisation…" >/dev/null || true
|
|
echo ""
|
|
|
|
# 1. Select initial theme
|
|
echo "Step 1: Choose your starting theme"
|
|
SELECTED_THEME="$(nomarchy-theme-list | gum filter --placeholder 'Select a theme...')"
|
|
if [[ -n "$SELECTED_THEME" ]]; then
|
|
THEME_ID=$(echo "$SELECTED_THEME" | tr '[:upper:]' '[:lower:]' | tr ' ' '-')
|
|
nomarchy-theme-set "$THEME_ID" --no-update
|
|
fi
|
|
|
|
# 2. Select initial font
|
|
echo "Step 2: Choose your preferred font"
|
|
SELECTED_FONT="$(nomarchy-font-list | gum filter --placeholder 'Select a font...')"
|
|
if [[ -n "$SELECTED_FONT" ]]; then
|
|
nomarchy-font-set "$SELECTED_FONT" --no-update
|
|
fi
|
|
|
|
# 3. Select panel position
|
|
echo "Step 3: Choose your preferred panel position"
|
|
POSITION=$(gum choose "top" "bottom")
|
|
if [[ -n "$POSITION" ]]; then
|
|
nomarchy-state-write panelPosition "$POSITION"
|
|
fi
|
|
|
|
# 4. Select monitor scaling
|
|
echo "Step 4: Choose your monitor scaling"
|
|
echo "Recommended: 'auto' for most screens, '2' for 4K/HiDPI."
|
|
SCALE=$(gum choose "auto" "1" "1.25" "1.5" "2")
|
|
if [[ -n "$SCALE" ]]; then
|
|
# Write to nested hyprland.scale key
|
|
STATE_DIR="$HOME/.config/nomarchy"
|
|
mkdir -p "$STATE_DIR"
|
|
TMP_FILE=\$(mktemp)
|
|
jq ".hyprland.scale = \"$SCALE\"" "\$STATE_FILE" > "\$TMP_FILE" && mv "\$TMP_FILE" "\$STATE_FILE"
|
|
fi
|
|
|
|
# Skip system-modifying steps in the Live ISO environment
|
|
if [[ "$USER" == "nixos" ]]; then
|
|
echo ""
|
|
echo "Live ISO detected. Skipping home.nix generation and git repo check."
|
|
nomarchy-env-update
|
|
nomarchy-state-write welcome_done true --type bool
|
|
gum style --foreground 82 "Setup complete! Enjoy your Nomarchy experience."
|
|
sleep 3
|
|
exit 0
|
|
fi
|
|
|
|
# 4. Setup Local Repo (Crucial for nomarchy-env-update to work)
|
|
echo ""
|
|
echo "Step 4: Git Repository Check"
|
|
echo "Nomarchy relies on a local git repository for declarative updates."
|
|
if [ ! -d "/etc/nixos/.git" ]; then
|
|
echo "Warning: /etc/nixos is not a git repository. Declarative updates might fail."
|
|
if gum confirm "Would you like to initialize /etc/nixos as a git repo?"; then
|
|
sudo git -C /etc/nixos init
|
|
sudo git -C /etc/nixos add .
|
|
sudo git -C /etc/nixos commit -m "Initial Nomarchy System Commit"
|
|
fi
|
|
fi
|
|
|
|
# 5. Success
|
|
echo ""
|
|
echo "Applying all changes..."
|
|
nomarchy-env-update
|
|
nomarchy-state-write welcome_done true --type bool
|
|
|
|
# Remove legacy flag file if it exists
|
|
rm -f "$HOME/.config/nomarchy/.first-run-done"
|
|
|
|
gum style --foreground 82 "Setup complete! Enjoy your Nomarchy experience."
|
|
sleep 3
|