#!/usr/bin/env nix-shell #!nix-shell -i zsh --packages nvd zsh # sudo is used for nixos-rebuild below due to: https://github.com/NixOS/nix/issues/7154 cd /etc/nixos && \ nix flake update && \ cd && \ sudo env TMPDIR=/nix/tmp nixos-rebuild switch --upgrade --show-trace && \ echo && \ nixos-rebuild list-generations | cat && \ echo && \ res=$(find /nix/var/nix/profiles -iname system-\* -type l -exec ls -ltr \{\} + | awk '{print $9}' | tail -2) if [[ ${?} -eq 0 && $(echo -E "${res}" | wc -l) -eq 2 ]]; then nvd diff $(echo -E "${res}" | xargs) fi