fix(theme): set default to summer-night and fix scripts on live ISO
- Update lib/state-schema.nix to default both home and system themes to 'summer-night'.
- Fix 'nomarchy-theme-list' and 'nomarchy-theme-set-templates' to resolve themes and templates from '~/.local/share/nomarchy' instead of the obsolete '$NOMARCHY_PATH' (fixing failures on Live ISO).
- Update 'nomarchy-welcome' to properly convert Title Case theme display names back to kebab-case identifiers and add input validation to prevent crashes.
- Fix installer impermanence symlink by using a relative path ('../persist/etc/nixos'), ensuring it resolves during 'nixos-install' both inside and outside the chroot.
- Deploy '~/.XCompose' symlink via Home Manager and add 'nomarchy-restart-xcompose' to the menu.
- Relocate 'Nomarchy.ttf' to 'core/branding/' and move user-level scripts ('pkg-add', 'pkg-remove', 'env-update', 'preflight-migration') to 'features/scripts/utils/' to align with the distro architecture.
- Remove obsolete '$NOMARCHY_PATH' exports and redundant 'bashrc' template.
- Export theme templates via 'xdg.dataFile' for script accessibility.
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
# If not running interactively, don't do anything (leave this at the top of this file)
|
||||
[[ $- != *i* ]] && return
|
||||
|
||||
# All the default Nomarchy aliases and functions
|
||||
# (don't mess with these directly, just overwrite them here!)
|
||||
source ~/.config/nomarchy/default/bash/rc
|
||||
|
||||
# Add your own exports, aliases, and functions here.
|
||||
#
|
||||
# Make an alias for invoking commands you use constantly
|
||||
# alias p='python'
|
||||
@@ -32,8 +32,7 @@ end
|
||||
function GetEntries()
|
||||
local entries = {}
|
||||
local user_theme_dir = os.getenv("HOME") .. "/.config/nomarchy/themes"
|
||||
local nomarchy_path = os.getenv("NOMARCHY_PATH") or "/etc/nixos"
|
||||
local default_theme_dir = nomarchy_path .. "/themes/palettes"
|
||||
local default_theme_dir = os.getenv("HOME") .. "/.local/share/nomarchy/themes"
|
||||
|
||||
local seen_themes = {}
|
||||
|
||||
|
||||
@@ -52,4 +52,8 @@ let
|
||||
in
|
||||
{
|
||||
xdg.configFile = configMappings;
|
||||
|
||||
home.file.".XCompose" = lib.mkDefault {
|
||||
source = ./config/nomarchy/default/xcompose;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ let
|
||||
pname = "nomarchy-font";
|
||||
version = "1.0";
|
||||
# Point directly to the font file
|
||||
src = ./../home/config/Nomarchy.ttf;
|
||||
src = ./../branding/Nomarchy.ttf;
|
||||
# No archive to unpack
|
||||
unpackPhase = "true";
|
||||
installPhase = ''
|
||||
|
||||
@@ -55,8 +55,7 @@ pkgs.stdenv.mkDerivation {
|
||||
for file in $out/bin/*; do
|
||||
if [ -f "$file" ]; then
|
||||
wrapProgram "$file" \
|
||||
--prefix PATH : "$deps" \
|
||||
--set NOMARCHY_PATH "/etc/nixos"
|
||||
--prefix PATH : "$deps"
|
||||
fi
|
||||
done
|
||||
'';
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nomarchy Environment Update Script
|
||||
# Standalone Home Manager iteration path. Use this for fast dotfile and
|
||||
# theme changes that don't need a full system rebuild. For first-boot
|
||||
# dotfiles and any system-level change, the NixOS module activation
|
||||
# from `sudo nixos-rebuild switch` is the source of truth.
|
||||
|
||||
set -e
|
||||
|
||||
if [ -f "/etc/nixos/flake.nix" ]; then
|
||||
REPO_DIR="/etc/nixos"
|
||||
elif [ -f "/etc/nomarchy/flake.nix" ]; then
|
||||
REPO_DIR="/etc/nomarchy"
|
||||
else
|
||||
echo "Error: Nomarchy flake repository not found in /etc/nixos or /etc/nomarchy."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if command -v nomarchy-preflight-migration >/dev/null 2>&1; then
|
||||
nomarchy-preflight-migration
|
||||
fi
|
||||
|
||||
echo "Applying user-level changes from $REPO_DIR#$USER..."
|
||||
if command -v home-manager >/dev/null 2>&1; then
|
||||
home-manager switch --flake "$REPO_DIR#$USER" --impure
|
||||
else
|
||||
# Bootstrap path: HM hasn't put `home-manager` on PATH yet (e.g. running
|
||||
# straight after a partial install). Pull it from the flake registry.
|
||||
nix --extra-experimental-features 'nix-command flakes' \
|
||||
run 'home-manager/release-25.11' \
|
||||
-- switch --flake "$REPO_DIR#$USER" --impure
|
||||
fi
|
||||
|
||||
echo "Environment update complete."
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
PKG_NAME="$1"
|
||||
|
||||
if [ -z "$PKG_NAME" ]; then
|
||||
echo "Usage: nomarchy-pkg-add <package-name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STATE_FILE="$HOME/.config/home-manager/user-packages.json"
|
||||
mkdir -p "$(dirname "$STATE_FILE")"
|
||||
|
||||
if [ ! -f "$STATE_FILE" ]; then
|
||||
echo "[]" > "$STATE_FILE"
|
||||
fi
|
||||
|
||||
if jq -e --arg pkg "$PKG_NAME" '. | index($pkg)' "$STATE_FILE" >/dev/null; then
|
||||
echo "Package $PKG_NAME is already in your user-packages.json"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Append package to the JSON array safely
|
||||
jq --arg pkg "$PKG_NAME" '. + [$pkg]' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
||||
|
||||
echo "Package $PKG_NAME added declaratively to $STATE_FILE."
|
||||
echo "Applying changes with nomarchy-env-update..."
|
||||
nomarchy-env-update
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
PKG_NAME="$1"
|
||||
|
||||
if [ -z "$PKG_NAME" ]; then
|
||||
echo "Usage: nomarchy-pkg-remove <package-name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
STATE_FILE="$HOME/.config/home-manager/user-packages.json"
|
||||
|
||||
if [ ! -f "$STATE_FILE" ]; then
|
||||
echo "No packages managed by nomarchy-pkg yet."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ! jq -e --arg pkg "$PKG_NAME" '. | index($pkg)' "$STATE_FILE" >/dev/null; then
|
||||
echo "Package $PKG_NAME is not in your user-packages.json"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Remove package from the JSON array safely
|
||||
jq --arg pkg "$PKG_NAME" '. - [$pkg]' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
|
||||
|
||||
echo "Package $PKG_NAME removed declaratively from $STATE_FILE."
|
||||
echo "Applying changes with nomarchy-env-update..."
|
||||
nomarchy-env-update
|
||||
@@ -1,94 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
# Nomarchy Pre-flight State Migration
|
||||
# Migrates legacy state files into the unified state.json before Nix evaluation
|
||||
|
||||
STATE_DIR="$HOME/.config/nomarchy"
|
||||
OLD_STATE_DIR="$HOME/.config/home-manager"
|
||||
OLD_TOGGLES_DIR="$HOME/.local/state/nomarchy/toggles"
|
||||
IDLE_STATE_FILE="$OLD_STATE_DIR/idle-state.json"
|
||||
NIGHTLIGHT_STATE_FILE="$OLD_STATE_DIR/hyprsunset-state.json"
|
||||
HYPRLAND_STATE_FILE="$OLD_STATE_DIR/hyprland-state.json"
|
||||
THEME_STATE_FILE="$OLD_STATE_DIR/theme-state.nix"
|
||||
WALLPAPER_STATE_FILE="$OLD_STATE_DIR/wallpaper-state.nix"
|
||||
FONT_STATE_FILE="$OLD_STATE_DIR/font-state.nix"
|
||||
OLD_STATE_FILE="$OLD_STATE_DIR/state.json"
|
||||
NEW_STATE_FILE="$STATE_DIR/state.json"
|
||||
|
||||
# We expect jq to be in PATH (it's a dependency of nomarchy-scripts)
|
||||
JQ="jq"
|
||||
|
||||
mkdir -p "$STATE_DIR"
|
||||
[[ ! -f $NEW_STATE_FILE ]] && echo "{}" > "$NEW_STATE_FILE"
|
||||
|
||||
# 0. Migrate from old home-manager state.json location
|
||||
if [[ -f "$OLD_STATE_FILE" ]] && [[ "$OLD_STATE_FILE" != "$NEW_STATE_FILE" ]]; then
|
||||
# Merge old state into new state
|
||||
TMP_FILE=$(mktemp)
|
||||
$JQ -s '.[0] * .[1]' "$OLD_STATE_FILE" "$NEW_STATE_FILE" > "$TMP_FILE" && mv "$TMP_FILE" "$NEW_STATE_FILE"
|
||||
rm "$OLD_STATE_FILE" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# 1. Migrate .local/state/nomarchy/toggles
|
||||
if [[ -d $OLD_TOGGLES_DIR ]]; then
|
||||
for file in "$OLD_TOGGLES_DIR"/*; do
|
||||
[[ -e "$file" ]] || continue
|
||||
filename=$(basename "$file")
|
||||
case "$filename" in
|
||||
suspend-off)
|
||||
$JQ '.suspend = false' "$NEW_STATE_FILE" > "$NEW_STATE_FILE.tmp" && mv "$NEW_STATE_FILE.tmp" "$NEW_STATE_FILE"
|
||||
;;
|
||||
screensaver-off)
|
||||
$JQ '.screensaver = false' "$NEW_STATE_FILE" > "$NEW_STATE_FILE.tmp" && mv "$NEW_STATE_FILE.tmp" "$NEW_STATE_FILE"
|
||||
;;
|
||||
skip-vscode-theme-changes)
|
||||
$JQ '.skipVsCodeTheme = true' "$NEW_STATE_FILE" > "$NEW_STATE_FILE.tmp" && mv "$NEW_STATE_FILE.tmp" "$NEW_STATE_FILE"
|
||||
;;
|
||||
esac
|
||||
rm "$file"
|
||||
done
|
||||
rmdir "$OLD_TOGGLES_DIR" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# 2. Migrate existing JSON state files
|
||||
if [[ -f $IDLE_STATE_FILE ]]; then
|
||||
ENABLED=$($JQ '.enabled' "$IDLE_STATE_FILE")
|
||||
if [[ "$ENABLED" == "true" || "$ENABLED" == "false" ]]; then
|
||||
$JQ --argjson val "$ENABLED" '.idle = $val' "$NEW_STATE_FILE" > "$NEW_STATE_FILE.tmp" && mv "$NEW_STATE_FILE.tmp" "$NEW_STATE_FILE"
|
||||
fi
|
||||
rm "$IDLE_STATE_FILE"
|
||||
fi
|
||||
|
||||
if [[ -f $NIGHTLIGHT_STATE_FILE ]]; then
|
||||
ENABLED=$($JQ '.enabled' "$NIGHTLIGHT_STATE_FILE")
|
||||
TEMP=$($JQ '.temperature' "$NIGHTLIGHT_STATE_FILE")
|
||||
$JQ --argjson enabled "$ENABLED" --argjson temp "$TEMP" '.nightlight = $enabled | .nightlightTemperature = $temp' "$NEW_STATE_FILE" > "$NEW_STATE_FILE.tmp" && mv "$NEW_STATE_FILE.tmp" "$NEW_STATE_FILE"
|
||||
rm "$NIGHTLIGHT_STATE_FILE"
|
||||
fi
|
||||
|
||||
if [[ -f $HYPRLAND_STATE_FILE ]]; then
|
||||
GAPS_OUT=$($JQ '.gaps_out' "$HYPRLAND_STATE_FILE")
|
||||
GAPS_IN=$($JQ '.gaps_in' "$HYPRLAND_STATE_FILE")
|
||||
BORDER_SIZE=$($JQ '.border_size' "$HYPRLAND_STATE_FILE")
|
||||
$JQ --argjson go "$GAPS_OUT" --argjson gi "$GAPS_IN" --argjson bs "$BORDER_SIZE" '.hyprland = {"gaps_out": $go, "gaps_in": $gi, "border_size": $bs}' "$NEW_STATE_FILE" > "$NEW_STATE_FILE.tmp" && mv "$NEW_STATE_FILE.tmp" "$NEW_STATE_FILE"
|
||||
rm "$HYPRLAND_STATE_FILE"
|
||||
fi
|
||||
|
||||
# 3. Migrate plaintext string state files
|
||||
if [[ -f $THEME_STATE_FILE ]]; then
|
||||
THEME=$(cat "$THEME_STATE_FILE" | tr -d '\n')
|
||||
$JQ --arg theme "$THEME" '.theme = $theme' "$NEW_STATE_FILE" > "$NEW_STATE_FILE.tmp" && mv "$NEW_STATE_FILE.tmp" "$NEW_STATE_FILE"
|
||||
rm "$THEME_STATE_FILE"
|
||||
fi
|
||||
|
||||
if [[ -f $WALLPAPER_STATE_FILE ]]; then
|
||||
WALLPAPER=$(cat "$WALLPAPER_STATE_FILE" | tr -d '\n')
|
||||
$JQ --arg wp "$WALLPAPER" '.wallpaper = $wp' "$NEW_STATE_FILE" > "$NEW_STATE_FILE.tmp" && mv "$NEW_STATE_FILE.tmp" "$NEW_STATE_FILE"
|
||||
rm "$WALLPAPER_STATE_FILE"
|
||||
fi
|
||||
|
||||
if [[ -f $FONT_STATE_FILE ]]; then
|
||||
FONT=$(cat "$FONT_STATE_FILE" | tr -d '\n')
|
||||
$JQ --arg font "$FONT" '.font = $font' "$NEW_STATE_FILE" > "$NEW_STATE_FILE.tmp" && mv "$NEW_STATE_FILE.tmp" "$NEW_STATE_FILE"
|
||||
rm "$FONT_STATE_FILE"
|
||||
fi
|
||||
Reference in New Issue
Block a user