Files
Nomarchy/bin/utils/nomarchy-migrate-state
Bernardo Magri b27fc5aee8 refactor: major architectural restructure for theme-centric organization
Theme System:
- Move all theme app configs to apps/ subdirectory (20 themes)
- Add theme-loader.nix for dynamic theme config deployment
- Simplify stylix.nix to focus on base theming only

Override System:
- Add overrides.nix for file-based config overrides
- Add behavior-configs.nix for non-visual configuration
- Split hypr/nomarchy.conf into behavior vs visual sections

Module Improvements:
- Add lib.mkDefault to all customizable settings
- Add modules/lib/ with shared utilities and state schema
- Update all home and system modules for downstream overridability

Installer:
- New minimal TTY installer (installer/install.sh)
- Golden path: BTRFS + LUKS2 (disko-golden.nix)
- New installer-iso.nix for TTY-only installation
- Keep graphical installer as installerIsoGraphical option

Cleanup:
- Remove obsolete install.sh, disko-ext4.nix, install-nomarchy.sh
- Update live-iso.nix references
- Add .claude/ to .gitignore for local IDE settings

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-11 19:38:27 +01:00

55 lines
1.6 KiB
Bash
Executable File

#!/usr/bin/env bash
# Nomarchy State Migration Script
# Migrates state from old locations to unified ~/.config/nomarchy/state.json
set -e
NEW_STATE_DIR="$HOME/.config/nomarchy"
NEW_STATE_FILE="$NEW_STATE_DIR/state.json"
OLD_HOME_STATE="$HOME/.config/home-manager/state.json"
OLD_SYSTEM_STATE="/etc/nixos/state.json"
mkdir -p "$NEW_STATE_DIR"
# Initialize new state file if it doesn't exist
if [[ ! -f "$NEW_STATE_FILE" ]]; then
echo "{}" > "$NEW_STATE_FILE"
fi
# Function to safely merge JSON
merge_json() {
local source="$1"
if [[ -f "$source" ]]; then
echo "Migrating from $source..."
TMP_FILE=$(mktemp)
# Merge source into new state (new state values take precedence if conflict)
jq -s '.[0] * .[1]' "$source" "$NEW_STATE_FILE" > "$TMP_FILE" && mv "$TMP_FILE" "$NEW_STATE_FILE"
fi
}
# Migrate old home-manager state
if [[ -f "$OLD_HOME_STATE" ]] && [[ "$OLD_HOME_STATE" != "$NEW_STATE_FILE" ]]; then
merge_json "$OLD_HOME_STATE"
echo "Old home state migrated. You can remove: $OLD_HOME_STATE"
fi
# Check if system state exists and user wants to sync it
if [[ -f "$OLD_SYSTEM_STATE" ]]; then
echo ""
echo "System state found at $OLD_SYSTEM_STATE"
echo "Note: System state will continue to be read from /etc/nixos/state.json"
echo " for system-level NixOS configuration."
fi
# Run the preflight migration for any legacy formats
if command -v nomarchy-preflight-migration &> /dev/null; then
nomarchy-preflight-migration
fi
echo ""
echo "Migration complete!"
echo "New state location: $NEW_STATE_FILE"
echo ""
echo "Current state:"
jq '.' "$NEW_STATE_FILE"