1
0
Fork 0
dotfiles/home/programs/scripts/nixpkgs-switch

43 lines
785 B
Text
Raw Normal View History

2022-08-02 19:01:17 +00:00
#!/usr/bin/env fish
set -g os (uname)
switch $os
case Darwin
set -g config_dir "$HOME/.config/nixpkgs"
case Linux
set -g config_dir /etc/nixos
case '*'
echo "Unsupported OS"
exit 1
end
pushd "$config_dir"
rm -rf result
set system_old (readlink /run/current-system)
switch $os
case Darwin
git pull
env TERM=xterm-256color darwin-rebuild switch --flake .
case Linux
sudo git pull
sudo nixos-rebuild switch --flake .
end
2022-08-11 19:00:49 +00:00
if test $status -eq 0
set system_new (readlink /run/current-system)
2022-08-02 19:01:17 +00:00
2022-08-11 19:00:49 +00:00
rm -f result
2022-08-02 19:01:17 +00:00
2022-08-11 19:00:49 +00:00
if test -e "$HOME/.bin/upload-nifoc-nix-cache"
echo "Updating nifoc-nix-cache ..."
upload-nifoc-nix-cache
end
2022-08-09 16:30:54 +00:00
2022-08-11 19:00:49 +00:00
nvd diff "$system_old" "$system_new"
2022-08-09 16:30:54 +00:00
end
2022-08-02 19:01:17 +00:00
popd