chore(audit): delete NixOS-irrelevant Omarchy port scripts
Pillar 3 Phase B, batch 2. Five `unused?` scripts that either duplicate NixOS-native facilities or reference infrastructure Nomarchy doesn't ship. All five had no callers anywhere in the tree. - `nomarchy-rollback`: ran `nixos-rebuild rollback` after listing `snapper` snapshots. NixOS already exposes the previous generation in the boot menu and `nixos-rebuild --rollback`; Nomarchy uses impermanence, not snapper. - `nomarchy-snapshot`: wrapped `snapper create/restore`. Same reason — snapper isn't part of Nomarchy. The script's "nomarchy-update can use this" comment never came true; nomarchy-update has no reference to it. - `nomarchy-migrate-state`: one-time migration from old `~/.config/home-manager/state.json` and `/etc/nixos/state.json` to the unified `~/.config/nomarchy/state.json`. The installer now seeds the unified file directly; no current install needs the migration. - `nomarchy-config-direct-boot`: added an EFI boot entry for a Nomarchy UKI. We don't build a UKI (no references anywhere in `core/` or `hosts/`), so the script targeted nonexistent infrastructure. - `nomarchy-npx-install`: generated npx wrappers in `~/.local/bin/`. An Arch idiom — on NixOS the path is `nix-shell -p nodejs` or a declarative `home.packages` entry. Kept `nomarchy-build-iso` and `nomarchy-build-live-iso` (the user-flagged useful build wrappers) and surfaced them in README §2 in place of the raw `nix build` command, which both removes the audit's `unused?` flag on them and shortens the docs. Regenerated docs/SCRIPTS.md (171 → 166 scripts; 28 `unused?` → 21). Logged in docs/ROADMAP.md Shipped. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Add an EFI boot entry for the Nomarchy UKI, allowing the system to boot directly
|
||||
# without a bootloader like Limine. Requires UEFI firmware and a built UKI.
|
||||
|
||||
if [[ ! -d /sys/firmware/efi ]]; then
|
||||
echo "Error: System is not booted in UEFI mode" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! efibootmgr &>/dev/null; then
|
||||
echo "Error: efibootmgr is not available or not functional" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if cat /sys/class/dmi/id/bios_vendor 2>/dev/null | grep -qi "American Megatrends"; then
|
||||
echo "Error: American Megatrends firmware may not safely support custom EFI entries" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if cat /sys/class/dmi/id/bios_vendor 2>/dev/null | grep -qi "Apple"; then
|
||||
echo "Error: Apple firmware uses its own boot manager" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
uki_file=$(find /boot/EFI/Linux/ -name "nomarchy*.efi" -printf "%f\n" 2>/dev/null | head -1)
|
||||
|
||||
if [[ -z $uki_file ]]; then
|
||||
echo "Error: No Nomarchy UKI found in /boot/EFI/Linux/" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
boot_source=$(findmnt -n -o SOURCE /boot)
|
||||
disk=$(echo "$boot_source" | sed 's/p\?[0-9]*$//')
|
||||
part=$(echo "$boot_source" | grep -o 'p\?[0-9]*$' | sed 's/^p//')
|
||||
|
||||
if gum confirm "Setup direct boot (so snapshot booting must be done via bios)?"; then
|
||||
echo "Creating EFI boot entry for $uki_file"
|
||||
|
||||
sudo efibootmgr --create \
|
||||
--disk "$disk" \
|
||||
--part "$part" \
|
||||
--label "Nomarchy" \
|
||||
--loader "\\EFI\\Linux\\$uki_file"
|
||||
fi
|
||||
@@ -1,54 +0,0 @@
|
||||
#!/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"
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# Install an npx wrapper for a given npm package.
|
||||
# Usage: nomarchy-npx-install <package> [command-name]
|
||||
#
|
||||
# If command-name is omitted, it defaults to the package name.
|
||||
# Example: nomarchy-npx-install opencode-ai opencode
|
||||
|
||||
if [[ -z $1 ]]; then
|
||||
echo "Usage: nomarchy-npx-install <package> [command-name]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
package=$1
|
||||
command=${2:-$1}
|
||||
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
|
||||
cat > "$HOME/.local/bin/$command" <<EOF
|
||||
#!/bin/bash
|
||||
exec npx --yes $package "\$@"
|
||||
EOF
|
||||
|
||||
chmod +x "$HOME/.local/bin/$command"
|
||||
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nomarchy Rollback Script
|
||||
# Reverts the system to a previous working generation.
|
||||
|
||||
set -e
|
||||
|
||||
if command -v snapper &>/dev/null; then
|
||||
echo "BTRFS Snapper detected. Listing snapshots..."
|
||||
sudo snapper list
|
||||
echo ""
|
||||
echo "To rollback to a specific snapshot, run: sudo snapper rollback <number>"
|
||||
echo "Or to rollback the current NixOS generation only:"
|
||||
fi
|
||||
|
||||
echo "Rolling back NixOS generation..."
|
||||
sudo nixos-rebuild rollback
|
||||
|
||||
echo "Rollback complete. Please reboot if you performed a BTRFS rollback."
|
||||
@@ -1,33 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
COMMAND="$1"
|
||||
|
||||
if [[ -z $COMMAND ]]; then
|
||||
echo "Usage: nomarchy-snapshot <create|restore>" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command -v snapper &>/dev/null; then
|
||||
exit 127 # nomarchy-update can use this to just ignore if snapper is not available
|
||||
fi
|
||||
|
||||
case "$COMMAND" in
|
||||
create)
|
||||
DESC="$(nomarchy-version)"
|
||||
|
||||
echo -e "\e[32mCreate system snapshot\e[0m"
|
||||
|
||||
# Get existing snapper config names from CSV output
|
||||
mapfile -t CONFIGS < <(sudo snapper --csvout list-configs | awk -F, 'NR>1 {print $1}')
|
||||
|
||||
for config in "${CONFIGS[@]}"; do
|
||||
sudo snapper -c "$config" create -c number -d "$DESC"
|
||||
done
|
||||
echo
|
||||
;;
|
||||
restore)
|
||||
sudo limine-snapper-restore
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user