about summary refs log tree commit diff stats
path: root/nix-conf/home/includes/scripts/system-changes-report.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix-conf/home/includes/scripts/system-changes-report.nix')
-rw-r--r--nix-conf/home/includes/scripts/system-changes-report.nix15
1 files changed, 15 insertions, 0 deletions
diff --git a/nix-conf/home/includes/scripts/system-changes-report.nix b/nix-conf/home/includes/scripts/system-changes-report.nix
new file mode 100644
index 0000000..56166cb
--- /dev/null
+++ b/nix-conf/home/includes/scripts/system-changes-report.nix
@@ -0,0 +1,15 @@
+{ config, pkgs, ... }:
+
+# https://github.com/gvolpe/nix-config/blob/e28a220d0087064e6bad6b992b4914a65eb545e5/home/scripts/changes-report.nix
+let
+  system-profiles = "/nix/var/nix/profiles/system-*-link";
+in
+pkgs.writeShellScriptBin "system-changes-report" ''
+  # Disable nvd if there are less than 2 hm profiles.
+  if [ $(ls -d1v ${system-profiles} 2>/dev/null | wc -l) -lt 2 ]; then
+    echo "Skipping changes report..."
+  else
+    ${pkgs.nvd}/bin/nvd diff $(ls -d1v ${system-profiles} | tail -2)
+  fi
+''
+