nixpkgs/home/packages/custom/update-nixos-system/default.nix
Daniel Siepmann bb64b6d859
Streamline push etckeeper and os update
The os update and backup now include etckeeper as its part of the
workflow.
The os updates now have the same name on all systems. That should reduce
friction, same command for same workflow, just different implementation.
2023-03-16 08:38:16 +01:00

18 lines
473 B
Nix

{ writeShellApplication }:
writeShellApplication {
name = "custom-update-operating-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"
sudo nix-env -p /nix/var/nix/profiles/system --delete-generations +3
nix store gc
nix store optimise
'';
}