aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/pretty-rebuild
blob: 30025bb532e4ee5f0c7132eca1197f20fa5ab8f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env nix-shell
#!nix-shell -i zsh --packages zsh

cd /etc/nixos && \
	nix flake update && \
	cd && \
	nixos-rebuild switch --upgrade --show-trace && \
	echo && \
	nixos-rebuild list-generations | cat && \
	echo && \
	res=$(find /nix/var/nix/profiles -iname system-\* -type l | sort | tail -2)

if [[ ${?} -eq 0 && $(echo -E "${res}" | wc -l) -eq 2 ]]; then
	echo "+ diff between $(echo -E "${res}" | xargs)\n"
	nix store diff-closures $(echo -E "${res}" | xargs)
fi