nix-managed-macbook/scripts/report-hm-changes.nix

14 lines
403 B
Nix

{ config, pkgs, ... }:
let
profiles = "/nix/var/nix/profiles/per-user/${config.home.username}/home-manager-*-link";
in
pkgs.writeShellScriptBin "report-hm-changes" ''
# Disable nvd if there are less than 2 hm profiles.
if [ $(ls -d1v ${profiles} 2>/dev/null | wc -l) -lt 2 ]; then
echo "Skipping changes report..."
else
${pkgs.nvd}/bin/nvd diff $(ls -d1v ${profiles} | tail -2)
fi
''