1234567891011121314151617181920212223242526272829303132 |
- #!/bin/sh --
- set -ue
- : "${NIX_PROFILES_DIR:=/nix/var/nix/profiles/per-user/${USER:?}}"
- generation_files() (
- cd "${NIX_PROFILES_DIR}/profile-${1:?}-link" || kill "${$}"
- fd . | sort
- )
- generation="${1:-$(
- nix-env --list-generations | sed -n '/current/s/\s\+\([0-9]\+\).*/\1/p'
- )}"
- previous_generation="${2:-$((generation - 1))}"
- : "$((generation + previous_generation))"
- exec 9<<EOF
- $(
- {
- generation_files "${previous_generation}" 4<&- | {
- generation_files "${generation}" 3<&- | {
- diff -Naur /dev/fd/3 -
- }
- } 3<&0 <&4 4<&-
- } 4<&0
- )
- EOF
- exec sed -n '/^[+-][^+-]/p' <&9
|