Add nixos update command
This commit is contained in:
parent
7d1c0c66b0
commit
3919c7abb6
|
@ -14,6 +14,7 @@ with pkgs; [
|
|||
# TODO: Create one `./packages/custom/default.nix which includes all other?
|
||||
(callPackage ./packages/custom/dmenu-scripts { })
|
||||
(callPackage ./packages/custom/update-system { })
|
||||
(callPackage ./packages/custom/update-nixos-system { })
|
||||
(callPackage ./packages/custom/update-ubuntu-system { })
|
||||
(callPackage ./packages/custom/push-etckeeper { })
|
||||
(callPackage ./packages/custom/backup { })
|
||||
|
|
19
home/packages/custom/update-nixos-system/default.nix
Normal file
19
home/packages/custom/update-nixos-system/default.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ writeShellApplication }:
|
||||
|
||||
writeShellApplication {
|
||||
name = "custom-update-nixos-system";
|
||||
|
||||
# Including this doesn't work
|
||||
|
||||
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 +5
|
||||
nix store gc
|
||||
nix store optimise
|
||||
'';
|
||||
}
|
Loading…
Reference in a new issue