Unify apply script across platforms and remove build-switch

This commit is contained in:
2026-03-06 13:40:08 +00:00
parent b662770683
commit 497b98cb70
6 changed files with 45 additions and 103 deletions

View File

@@ -1,15 +0,0 @@
#!/usr/bin/env nu
use ../common.nu *
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,30 +0,0 @@
#!/usr/bin/env nu
use ../common.nu *
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"
}