feat(audit): address batch 2 of missing scripts
- Implement nomarchy-version, nomarchy-debug, nomarchy-reinstall, nomarchy-rollback, nomarchy-upload-log - Implement nomarchy-refresh-hyprland and nomarchy-refresh-waybar - Update docs/SCRIPTS.md with 'kept' status for new scripts
This commit is contained in:
69
features/scripts/utils/nomarchy-debug
Executable file
69
features/scripts/utils/nomarchy-debug
Executable file
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nomarchy Debug Information Script
|
||||
# Collects system information for troubleshooting.
|
||||
|
||||
set -e
|
||||
|
||||
# Flags for agent use to avoid hanging
|
||||
PRINT_ONLY=false
|
||||
if [[ "$*" == *"--print"* ]]; then
|
||||
PRINT_ONLY=true
|
||||
fi
|
||||
|
||||
echo "--- Nomarchy Debug Info ---"
|
||||
echo "Version: $(nomarchy-version)"
|
||||
echo "Host: $(hostname)"
|
||||
echo "Kernel: $(uname -r)"
|
||||
echo "Uptime: $(uptime -p)"
|
||||
|
||||
echo ""
|
||||
echo "--- Graphics ---"
|
||||
if command -v hyprctl &>/dev/null; then
|
||||
hyprctl version | head -n 1
|
||||
fi
|
||||
if command -v glxinfo &>/dev/null; then
|
||||
glxinfo | grep "OpenGL renderer" || echo "OpenGL: info not available"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "--- Nix/NixOS ---"
|
||||
nix --version
|
||||
if [[ -f /etc/os-release ]]; then
|
||||
grep "PRETTY_NAME" /etc/os-release | cut -d'"' -f2
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "--- Nomarchy State ---"
|
||||
STATE_FILE="$HOME/.config/nomarchy/state.json"
|
||||
if [[ -f "$STATE_FILE" ]]; then
|
||||
jq '.' "$STATE_FILE"
|
||||
else
|
||||
echo "State file not found at $STATE_FILE"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "--- Services Status ---"
|
||||
for svc in waybar hypridle hyprlock walker fprintd fwupd; do
|
||||
if systemctl is-active --quiet "$svc" 2>/dev/null || systemctl --user is-active --quiet "$svc" 2>/dev/null; then
|
||||
echo "[ACTIVE] $svc"
|
||||
else
|
||||
echo "[INACTIVE] $svc"
|
||||
fi
|
||||
done
|
||||
|
||||
echo ""
|
||||
echo "--- End of Debug Info ---"
|
||||
|
||||
if [[ "$PRINT_ONLY" == "false" ]]; then
|
||||
echo ""
|
||||
echo "Would you like to upload this log to a pastebin? (y/N)"
|
||||
read -r answer
|
||||
if [[ "$answer" =~ ^[Yy]$ ]]; then
|
||||
if command -v nomarchy-upload-log &>/dev/null; then
|
||||
nomarchy-debug --print | nomarchy-upload-log
|
||||
else
|
||||
echo "Error: nomarchy-upload-log not found."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
14
features/scripts/utils/nomarchy-refresh-hyprland
Executable file
14
features/scripts/utils/nomarchy-refresh-hyprland
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nomarchy Refresh Hyprland Script
|
||||
# Reloads the Hyprland configuration.
|
||||
|
||||
set -e
|
||||
|
||||
if command -v hyprctl &>/dev/null; then
|
||||
hyprctl reload
|
||||
notify-send -u low " Hyprland configuration reloaded"
|
||||
else
|
||||
echo "Error: hyprctl not found."
|
||||
exit 1
|
||||
fi
|
||||
14
features/scripts/utils/nomarchy-refresh-waybar
Executable file
14
features/scripts/utils/nomarchy-refresh-waybar
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nomarchy Refresh Waybar Script
|
||||
# Restarts Waybar to apply new configuration or theme.
|
||||
|
||||
set -e
|
||||
|
||||
if command -v nomarchy-restart-waybar &>/dev/null; then
|
||||
nomarchy-restart-waybar
|
||||
notify-send -u low " Waybar refreshed"
|
||||
else
|
||||
echo "Error: nomarchy-restart-waybar not found."
|
||||
exit 1
|
||||
fi
|
||||
22
features/scripts/utils/nomarchy-reinstall
Executable file
22
features/scripts/utils/nomarchy-reinstall
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nomarchy Reinstall Script
|
||||
# Performs a fresh 'switch' to the current declarative state.
|
||||
|
||||
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
|
||||
|
||||
echo "Performing system reinstall from $REPO_DIR..."
|
||||
# --refresh forces a download of flake inputs if they've changed upstream but not in lock
|
||||
sudo nixos-rebuild switch --flake "$REPO_DIR#default" --refresh --impure
|
||||
|
||||
echo "Reinstall complete."
|
||||
19
features/scripts/utils/nomarchy-rollback
Executable file
19
features/scripts/utils/nomarchy-rollback
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/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."
|
||||
25
features/scripts/utils/nomarchy-upload-log
Executable file
25
features/scripts/utils/nomarchy-upload-log
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nomarchy Log Upload Script
|
||||
# Uploads stdin or a file to a pastebin service.
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -t 0 ]] && [[ -z $1 ]]; then
|
||||
echo "Usage: some-command | nomarchy-upload-log"
|
||||
echo " nomarchy-upload-log <file>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Use ix.io as the default pastebin
|
||||
if [[ -n $1 ]]; then
|
||||
url=$(curl -F "f:1=@$1" ix.io)
|
||||
else
|
||||
url=$(curl -F "f:1=@-" ix.io)
|
||||
fi
|
||||
|
||||
echo "Log uploaded to: $url"
|
||||
if command -v wl-copy &>/dev/null; then
|
||||
echo "$url" | wl-copy
|
||||
echo "Link copied to clipboard."
|
||||
fi
|
||||
9
features/scripts/utils/nomarchy-version
Executable file
9
features/scripts/utils/nomarchy-version
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Nomarchy Version Script
|
||||
# Prints the current Nomarchy version based on the upstream NixOS channel.
|
||||
|
||||
VERSION="25.11.0"
|
||||
CODENAME="Markhor"
|
||||
|
||||
echo "Nomarchy v${VERSION} (${CODENAME})"
|
||||
Reference in New Issue
Block a user