2022-11-11 14:08:34 +01:00
|
|
|
{ writeShellApplication }:
|
|
|
|
|
|
|
|
writeShellApplication {
|
|
|
|
name = "custom-update-nixos-system";
|
|
|
|
|
|
|
|
text = ''
|
|
|
|
sudo nixos-rebuild switch --upgrade-all
|
|
|
|
|
|
|
|
# shellcheck disable=SC2010
|
|
|
|
oldVersion=$(ls -vr /nix/var/nix/profiles/ | grep system | head -n 2 | tail -n 1)
|
|
|
|
nvd diff "/nix/var/nix/profiles/$oldVersion" "/nix/var/nix/profiles/system"
|
|
|
|
|
2023-02-24 11:52:43 +01:00
|
|
|
sudo nix-env -p /nix/var/nix/profiles/system --delete-generations +3
|
2022-11-11 14:08:34 +01:00
|
|
|
nix store gc
|
|
|
|
nix store optimise
|
|
|
|
'';
|
|
|
|
}
|