1
0
Fork 0
dotfiles/home/programs/scripts/nixpkgs-switch
2023-06-23 20:08:22 +02:00

31 lines
628 B
Fish
Executable file

#!/usr/bin/env fish
set -f nix_os (uname)
set -f nix_hostname (hostname -s)
switch $nix_os
case Darwin
set -f config_dir "$HOME/.config/nixpkgs"
case Linux
set -f config_dir /etc/nixos
case '*'
echo "Unsupported OS"
exit 1
end
pushd "$config_dir"
rm -rf result
switch $nix_os
case Darwin
git pull
nom build ".#darwinConfigurations.$nix_hostname.config.system.build.toplevel"
env TERM=xterm-256color darwin-rebuild switch --flake ".#$nix_hostname"
case Linux
sudo git pull
sudo nixos-rebuild switch --flake .
end
rm -f result
popd