aboutsummaryrefslogtreecommitdiffstats
path: root/nix-conf/pkgs/scripts/home-changes-report.nix
blob: 62c5d99c2ab4f3b572eac50194758fc3600af8ab (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
{ lib, pkgs, ... }:

# https://github.com/gvolpe/nix-config/blob/e28a220d0087064e6bad6b992b4914a65eb545e5/home/scripts/changes-report.nix
pkgs.writeShellScriptBin "home-changes-report" ''
  hm_profiles="$HOME/.local/state/nix/profiles/home-manager-*-link"

  # Skip the diff if there are fewer than 2 hm profiles.
  if [ $(ls -d1v $hm_profiles 2>/dev/null | wc -l) -lt 2 ]; then
    echo "Skipping changes report..."
  else
    ${lib.getExe pkgs.dix} $(ls -d1v $hm_profiles | tail -2)
  fi
''