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>
This commit is contained in:
@@ -247,6 +247,7 @@ show_setup_config_menu() {
|
||||
*Walker*) open_in_editor ~/.config/walker/config.toml && nomarchy-restart-walker ;;
|
||||
*Waybar*) open_in_editor ~/.config/waybar/config.jsonc && nomarchy-restart-waybar ;;
|
||||
*XCompose*) open_in_editor ~/.XCompose && nomarchy-restart-xcompose ;;
|
||||
*Overrides*) xdg-open ~/.config/nomarchy/overrides/ ;;
|
||||
*) show_setup_menu ;;
|
||||
esac
|
||||
}
|
||||
|
||||
54
bin/utils/nomarchy-migrate-state
Executable file
54
bin/utils/nomarchy-migrate-state
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/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"
|
||||
100
bin/utils/nomarchy-state-write
Executable file
100
bin/utils/nomarchy-state-write
Executable file
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env bash
|
||||
# Nomarchy Atomic State Write Helper
|
||||
# Provides atomic JSON state updates with flock to prevent race conditions
|
||||
#
|
||||
# Usage:
|
||||
# nomarchy-state-write <key> <value> [--type string|bool|number|json]
|
||||
# nomarchy-state-write --file <path> <key> <value> [--type ...]
|
||||
#
|
||||
# Examples:
|
||||
# nomarchy-state-write theme "nord"
|
||||
# nomarchy-state-write idle true --type bool
|
||||
# nomarchy-state-write hyprland '{"gaps_in": 5}' --type json
|
||||
# nomarchy-state-write --file /etc/nixos/state.json dns "Cloudflare"
|
||||
|
||||
set -e
|
||||
|
||||
# Default state file
|
||||
STATE_FILE="$HOME/.config/nomarchy/state.json"
|
||||
VALUE_TYPE="string"
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--file)
|
||||
STATE_FILE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--type)
|
||||
VALUE_TYPE="$2"
|
||||
shift 2
|
||||
;;
|
||||
*)
|
||||
if [[ -z "$KEY" ]]; then
|
||||
KEY="$1"
|
||||
elif [[ -z "$VALUE" ]]; then
|
||||
VALUE="$1"
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -z "$KEY" ]] || [[ -z "$VALUE" ]]; then
|
||||
echo "Usage: nomarchy-state-write <key> <value> [--type string|bool|number|json]"
|
||||
echo " nomarchy-state-write --file <path> <key> <value> [--type ...]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure directory exists
|
||||
mkdir -p "$(dirname "$STATE_FILE")"
|
||||
|
||||
# Initialize file if it doesn't exist
|
||||
[[ ! -f "$STATE_FILE" ]] && echo "{}" > "$STATE_FILE"
|
||||
|
||||
# Create lock file path
|
||||
LOCK_FILE="${STATE_FILE}.lock"
|
||||
|
||||
# Perform atomic update with flock
|
||||
(
|
||||
flock -x 200
|
||||
|
||||
TMP_FILE=$(mktemp)
|
||||
trap "rm -f '$TMP_FILE'" EXIT
|
||||
|
||||
case "$VALUE_TYPE" in
|
||||
string)
|
||||
jq --arg val "$VALUE" ".$KEY = \$val" "$STATE_FILE" > "$TMP_FILE"
|
||||
;;
|
||||
bool)
|
||||
if [[ "$VALUE" == "true" ]] || [[ "$VALUE" == "false" ]]; then
|
||||
jq --argjson val "$VALUE" ".$KEY = \$val" "$STATE_FILE" > "$TMP_FILE"
|
||||
else
|
||||
echo "Error: Boolean value must be 'true' or 'false'"
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
number)
|
||||
jq --argjson val "$VALUE" ".$KEY = \$val" "$STATE_FILE" > "$TMP_FILE"
|
||||
;;
|
||||
json)
|
||||
jq --argjson val "$VALUE" ".$KEY = \$val" "$STATE_FILE" > "$TMP_FILE"
|
||||
;;
|
||||
*)
|
||||
echo "Error: Unknown type '$VALUE_TYPE'. Use string, bool, number, or json."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# Validate JSON before moving
|
||||
if jq empty "$TMP_FILE" 2>/dev/null; then
|
||||
mv "$TMP_FILE" "$STATE_FILE"
|
||||
else
|
||||
echo "Error: Failed to generate valid JSON"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
) 200>"$LOCK_FILE"
|
||||
|
||||
# Clean up lock file
|
||||
rm -f "$LOCK_FILE"
|
||||
Reference in New Issue
Block a user