dendritic migration

dendritic migration
This commit is contained in:
2026-03-05 10:58:00 +00:00
parent 05544d0597
commit e463c42740
142 changed files with 4411 additions and 2779 deletions

View File

@@ -1,27 +1,30 @@
#!/usr/bin/env bash
#!/usr/bin/env nu
set -euo pipefail
source "$(dirname "$0")/../common.sh"
use ../common.nu *
HOSTNAME="${1:-$(scutil --get LocalHostName 2>/dev/null || hostname -s)}"
print_info "Building and switching configuration for $HOSTNAME"
# Build
print_info "Building configuration..."
if ! nix build ".#darwinConfigurations.$HOSTNAME.system" --show-trace "${@:2}"; then
print_error "Build failed"
exit 1
fi
print_success "Build completed"
# Switch
print_info "Switching to new configuration..."
sudo ./result/sw/bin/darwin-rebuild switch --flake ".#$HOSTNAME" "${@:2}"
if [[ -L ./result ]]; then
unlink ./result
fi
print_success "Build and switch completed successfully"
def main [hostname?: string, ...rest: string] {
let host = if ($hostname | is-empty) {
try { scutil --get LocalHostName | str trim } catch { hostname -s | str trim }
} else { $hostname }
print_info $"Building and switching configuration for ($host)"
# Build
print_info "Building configuration..."
if (nix build $".#darwinConfigurations.($host).system" --show-trace ...$rest | complete).exit_code != 0 {
print_error "Build failed"
exit 1
}
print_success "Build completed"
# Switch
print_info "Switching to new configuration..."
sudo ./result/sw/bin/darwin-rebuild switch --flake $".#($host)" ...$rest
if ("./result" | path exists) {
rm ./result
}
print_success "Build and switch completed successfully"
}