fix: dynamic flake path resolution and replace env-update/sys-update aliases with scripts
This commit is contained in:
@@ -23,4 +23,4 @@ jq --argjson val "$NEW_VALUE" '.screensaver = $val' "$STATE_FILE" > "$TMP_JSON"
|
||||
|
||||
echo "Screensaver state set to $NEW_VALUE. Updating environment..."
|
||||
|
||||
env-update
|
||||
nomarchy-env-update
|
||||
|
||||
@@ -6,13 +6,23 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Detect the repository location
|
||||
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
|
||||
|
||||
# Use the pre-flight migration script to ensure the state is synced before evaluation
|
||||
if command -v nomarchy-preflight-migration >/dev/null 2>&1; then
|
||||
nomarchy-preflight-migration
|
||||
fi
|
||||
|
||||
# Apply Home Manager changes from the local flake
|
||||
echo "Applying user-level changes..."
|
||||
home-manager switch --flake /etc/nixos#default --impure
|
||||
echo "Applying user-level changes from $REPO_DIR..."
|
||||
home-manager switch --flake "$REPO_DIR#default" --impure
|
||||
|
||||
echo "Environment update complete."
|
||||
|
||||
@@ -5,8 +5,18 @@
|
||||
|
||||
set -e
|
||||
|
||||
# Detect the repository location
|
||||
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
|
||||
|
||||
# Apply NixOS changes from the local flake
|
||||
echo "Applying system-level changes..."
|
||||
sudo nixos-rebuild switch --flake /etc/nixos#default --impure
|
||||
echo "Applying system-level changes from $REPO_DIR..."
|
||||
sudo nixos-rebuild switch --flake "$REPO_DIR#default" --impure
|
||||
|
||||
echo "System update complete."
|
||||
|
||||
@@ -29,7 +29,7 @@ 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 env-update to work)
|
||||
# 3. Setup Local Repo (Crucial for nomarchy-env-update to work)
|
||||
echo ""
|
||||
echo "Nomarchy relies on a local git repository for declarative updates."
|
||||
if [ ! -d "/etc/nixos/.git" ]; then
|
||||
|
||||
Reference in New Issue
Block a user