#!/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" }