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

12 lines
406 B
Nix
Raw Normal View History

2022-10-27 11:31:08 +05:30
{ config, pkgs, ... }:
2024-01-31 19:23:23 +05:30
let profiles = "/nix/var/nix/profiles/per-user/${config.home.username}/profile-*-link";
in pkgs.writeShellScriptBin "report-hm-changes" ''
2022-10-27 11:31:08 +05:30
# Disable nvd if there are less than 2 hm profiles.
2023-12-09 12:14:27 +05:30
if [ $(/bin/ls -d1v ${profiles} 2>/dev/null | wc -l) -lt 2 ]; then
2022-10-27 11:31:08 +05:30
echo "Skipping changes report..."
else
2023-12-09 12:14:27 +05:30
${pkgs.nvd}/bin/nvd diff $(/bin/ls -d1v ${profiles} | tail -2)
2022-10-27 11:31:08 +05:30
fi
''