Configured Stylix (Disabled for now). Added plasma manager to configure kde plasma deterministically.

This commit is contained in:
2025-11-22 14:17:08 +01:00
parent 949ef79e1c
commit d345c5e207
7 changed files with 517 additions and 139 deletions

View File

@ -26,15 +26,8 @@ in
echo "Usage: ncli [command]"
echo ""
echo "System Commands:"
echo " rebuild - Rebuild the NixOS system configuration for current host ($HOST)."
echo " rebuild-boot - Rebuild and set as boot default (activates on next restart)."
echo " update - Update the flake and rebuild the system for current host."
echo " switch-host - Interactive host switcher (same as ./switch-host.sh)."
echo ""
echo "Multi-Host Commands:"
echo " build [HOST] - Build configuration for specific host (no activation)."
echo " deploy [HOST] - Build and switch to specific host configuration."
echo " list-hosts - List all available host configurations."
echo " rebuild - Rebuild the NixOS system configuration."
echo " update - Update the flake and rebuild the system."
echo ""
echo "Maintenance Commands:"
echo " cleanup - Clean up old system generations. Can specify a number to keep."
@ -50,7 +43,6 @@ in
echo ""
echo " help - Show this help message."
echo ""
echo "Current Host: $HOST"
}
handle_backups() {
@ -69,71 +61,6 @@ in
done
}
list_available_hosts() {
if [ ! -d "$HOME/$PROJECT/hosts" ]; then
echo "Error: Hosts directory not found at $HOME/$PROJECT/hosts" >&2
return 1
fi
echo "Available hosts:"
for host_dir in "$HOME/$PROJECT/hosts"/*; do
if [ -d "$host_dir" ]; then
hostname=$(basename "$host_dir")
if [ "$hostname" != "default" ]; then
if [ "$hostname" = "$HOST" ]; then
echo " $hostname (current)"
else
echo " $hostname"
fi
fi
fi
done
}
validate_host() {
local target_host="$1"
if [ ! -d "$HOME/$PROJECT/hosts/$target_host" ]; then
echo "Error: Host '$target_host' not found in $HOME/$PROJECT/hosts/" >&2
echo "Available hosts:" >&2
list_available_hosts >&2
return 1
fi
return 0
}
build_host() {
local target_host="$1"
validate_host "$target_host" || return 1
echo "Building configuration for host: $target_host"
cd "$HOME/$PROJECT" || { echo "Error: Could not change to $HOME/$PROJECT"; return 1; }
if nixos-rebuild build --flake ".#$target_host"; then
echo " Build successful for $target_host"
return 0
else
echo " Build failed for $target_host" >&2
return 1
fi
}
deploy_host() {
local target_host="$1"
validate_host "$target_host" || return 1
echo "Deploying configuration for host: $target_host"
cd "$HOME/$PROJECT" || { echo "Error: Could not change to $HOME/$PROJECT"; return 1; }
if sudo nixos-rebuild switch --flake ".#$target_host"; then
echo " Successfully deployed $target_host configuration"
echo "System is now running $target_host configuration."
return 0
else
echo " Deployment failed for $target_host" >&2
return 1
fi
}
# --- Main Logic ---
if [ "$#" -eq 0 ]; then
echo "Error: No command provided." >&2
@ -176,8 +103,6 @@ in
{
echo "=== NixOS System Diagnostic Report ==="
echo "Generated: $(date)"
echo "Host: $HOST"
echo "Hostname: $(hostname)"
echo ""
echo "=== System Information ==="
inxi --full 2>/dev/null || echo "inxi not available"
@ -185,8 +110,6 @@ in
echo "=== Git Status ==="
cd "$HOME/$PROJECT" 2>/dev/null && git status 2>/dev/null || echo "Git status not available"
echo ""
echo "=== Available Hosts ==="
list_available_hosts 2>/dev/null || echo "Could not list hosts"
} > "$HOME/diag.txt"
echo "Diagnostic report saved to $HOME/diag.txt"
;;
@ -200,9 +123,6 @@ in
echo "--- System Generations ---"
nix profile history --profile /nix/var/nix/profiles/system | cat || echo "Could not list system generations."
;;
list-hosts)
list_available_hosts
;;
rebuild)
handle_backups
echo "Starting NixOS rebuild for current host: $HOST"
@ -214,18 +134,6 @@ in
exit 1
fi
;;
rebuild-boot)
handle_backups
echo "Starting NixOS rebuild with boot option for current host: $HOST"
cd "$HOME/$PROJECT" || { echo "Error: Could not change to $HOME/$PROJECT"; exit 1; }
if sudo nixos-rebuild boot --flake ".#$HOST"; then
echo " Rebuild with boot option finished successfully for $HOST"
echo "Changes will activate on next restart"
else
echo " Rebuild with boot option failed for $HOST" >&2
exit 1
fi
;;
update)
handle_backups
echo "Updating flake and rebuilding system for current host: $HOST"
@ -247,30 +155,6 @@ in
exit 1
fi
;;
build)
if [ "$#" -lt 2 ]; then
echo "Usage: ncli build <hostname>" >&2
list_available_hosts
exit 1
fi
build_host "$2"
;;
deploy)
if [ "$#" -lt 2 ]; then
echo "Usage: ncli deploy <hostname>" >&2
list_available_hosts
exit 1
fi
deploy_host "$2"
;;
switch-host)
if [ -f "$HOME/$PROJECT/switch-host.sh" ]; then
cd "$HOME/$PROJECT" && ./switch-host.sh
else
echo "Error: switch-host.sh not found in $HOME/$PROJECT" >&2
exit 1
fi
;;
commit)
cd "$HOME/$PROJECT" || { echo "Error: Could not change to $HOME/$PROJECT"; exit 1; }
if [ "$#" -lt 2 ]; then