fix: rebuild abbreviation 自动从 hostname 推导 flake attr

hostname awesome-mac-mini → flake attr mac-mini
hostname awesome-macbook-air → flake attr macbook-air
WSL 硬编码 #wsl(唯一 NixOS host)
This commit is contained in:
2026-04-11 00:14:17 +08:00
parent 52836c0490
commit ac7f9f8b8a
2 changed files with 7 additions and 4 deletions
+4 -3
View File
@@ -41,11 +41,12 @@
# Sudo: double Escape to prepend sudo
bind \e\e 'fish_commandline_prepend sudo'
# Platform-specific rebuild command
# Platform-specific rebuild command (derive flake attr from hostname)
if test (uname) = Darwin
abbr --add rebuild "sudo darwin-rebuild switch --flake ~/Developer/nix-config"
set -l attr (scutil --get LocalHostName | string lower | string replace 'awesome-' '')
abbr --add rebuild "sudo darwin-rebuild switch --flake ~/Developer/nix-config#$attr"
else
abbr --add rebuild "sudo nixos-rebuild switch --flake ~/Developer/nix-config"
abbr --add rebuild "sudo nixos-rebuild switch --flake ~/Developer/nix-config#wsl"
end
# WSL clipboard