about summary refs log blame commit diff stats
path: root/nix-conf/home/includes/scripts/hm-changes-report.nix
blob: 0df6e4cffa94ab91c04d04e332190da2e09700a2 (plain) (tree)
1
2
3
4
5
6
7



                                                                                                                    


                                                                                 







                                                                  
{ config, pkgs, ... }:

# https://github.com/gvolpe/nix-config/blob/e28a220d0087064e6bad6b992b4914a65eb545e5/home/scripts/changes-report.nix
let
  hm-profiles =
    "${config.home.homeDirectory}/.local/state/nix/profiles/home-manager-*-link";
in pkgs.writeShellScriptBin "hm-changes-report" ''
  # Disable nvd if there are less than 2 hm profiles.
  if [ $(ls -d1v ${hm-profiles} 2>/dev/null | wc -l) -lt 2 ]; then
    echo "Skipping changes report..."
  else
    ${pkgs.nvd}/bin/nvd diff $(ls -d1v ${hm-profiles} | tail -2)
  fi
''