feat(scripts): extend nomarchy-welcome into a guided wizard

- Added nomarchy.panelPosition option and state persistence.
- Updated Waybar to respect the panelPosition setting.
- Refactored nomarchy-welcome to use state.json instead of a flag file.
- Added prompts for theme, font, panel position, and starter home.nix generation.
- Updated documentation and roadmap.
This commit is contained in:
Bernardo Magri
2026-04-26 20:02:52 +01:00
parent c66f0b19cd
commit dd48411013
8 changed files with 65 additions and 11 deletions

View File

@@ -28,6 +28,7 @@ let
else builtins.filter (m: !(builtins.elem m laptopOnlyModules)) mods;
settings = rawSettings // {
position = config.nomarchy.panelPosition;
modules-left = filterModules (rawSettings.modules-left or []);
modules-center = filterModules (rawSettings.modules-center or []);
modules-right = filterModules (rawSettings.modules-right or []);

View File

@@ -1,9 +1,13 @@
#!/usr/bin/env bash
FLAG_FILE="$HOME/.config/nomarchy/.first-run-done"
STATE_FILE="$HOME/.config/nomarchy/state.json"
if [ -f "$FLAG_FILE" ]; then
exit 0
# 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
@@ -29,8 +33,44 @@ nomarchy-theme-set "$(nomarchy-theme-list | gum filter --placeholder 'Select a t
echo "Step 2: Choose your preferred font"
nomarchy-font-set "$(nomarchy-font-list | gum filter --placeholder 'Select a font...')"
# 3. Setup Local Repo (Crucial for nomarchy-env-update to work)
# 3. Select panel position
echo "Step 3: Choose your preferred panel position"
POSITION=$(gum choose "top" "bottom")
nomarchy-state-write panelPosition "$POSITION"
# 4. Starter home.nix
echo ""
echo "Step 4: Starter home.nix"
HOME_NIX="$HOME/.config/home-manager/home.nix"
if [ ! -f "$HOME_NIX" ]; then
echo "It looks like you don't have a ~/.config/home-manager/home.nix file yet."
echo "Nomarchy uses this file to manage your user-level packages and settings."
if gum confirm "Would you like to generate a starter home.nix?"; then
mkdir -p "$(dirname "$HOME_NIX")"
cat <<EOF > "$HOME_NIX"
{ pkgs, ... }:
{
# Nomarchy starter home.nix
# Add your user packages here.
home.packages = with pkgs; [
btop
fastfetch
chromium
# Add more packages here
];
# home.stateVersion = "25.11"; # Consult docs/MIGRATION.md if you change this
}
EOF
echo "Starter home.nix generated at $HOME_NIX"
fi
else
echo "Detected existing home.nix at $HOME_NIX. Skipping generation."
fi
# 5. Setup Local Repo (Crucial for nomarchy-env-update to work)
echo ""
echo "Step 5: 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."
@@ -41,9 +81,11 @@ if [ ! -d "/etc/nixos/.git" ]; then
fi
fi
# 4. Success
mkdir -p "$(dirname "$FLAG_FILE")"
touch "$FLAG_FILE"
# 6. Success
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