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,12 +1,15 @@
#!/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 "Applying configuration for $HOSTNAME"
nix run nix-darwin -- switch --flake ".#$HOSTNAME" "${@:2}"
print_success "Configuration applied 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 $"Applying configuration for ($host)"
nix run nix-darwin -- switch --flake $".#($host)" ...$rest
print_success "Configuration applied successfully"
}

View File

@@ -1,16 +1,19 @@
#!/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 configuration for $HOSTNAME"
nix build ".#darwinConfigurations.$HOSTNAME.system" --show-trace "${@:2}"
if [[ -L ./result ]]; then
unlink ./result
fi
print_success "Build 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 configuration for ($host)"
nix build $".#darwinConfigurations.($host).system" --show-trace ...$rest
if ("./result" | path exists) {
rm ./result
}
print_success "Build completed successfully"
}

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"
}

View File

@@ -1,20 +1,20 @@
#!/usr/bin/env bash
#!/usr/bin/env nu
set -euo pipefail
source "$(dirname "$0")/../common.sh"
use ../common.nu *
print_info "Available generations:"
darwin-rebuild --list-generations
echo -n "Enter generation number to rollback to: "
read -r GEN_NUM
if [[ -z "$GEN_NUM" ]]; then
print_error "No generation number provided"
exit 1
fi
print_warning "Rolling back to generation $GEN_NUM..."
darwin-rebuild switch --switch-generation "$GEN_NUM"
print_success "Rollback to generation $GEN_NUM complete"
def main [] {
print_info "Available generations:"
darwin-rebuild --list-generations
let gen_num = input "Enter generation number to rollback to: "
if ($gen_num | is-empty) {
print_error "No generation number provided"
exit 1
}
print_warning $"Rolling back to generation ($gen_num)..."
darwin-rebuild switch --switch-generation $gen_num
print_success $"Rollback to generation ($gen_num) complete"
}