aboutsummaryrefslogtreecommitdiffstats
path: root/nix-conf/pkgs/scripts/system-changes-report.nix
blob: 8c2c2ac09195f59dd2014ba298db0eed078e7e14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{ lib, 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" ''
  # Skip the diff if there are less than 2 system profiles.
  if [ $(ls -d1v ${system-profiles} 2>/dev/null | wc -l) -lt 2 ]; then
    echo "Skipping changes report..."
  else
    ${lib.getExe pkgs.dix} $(ls -d1v ${system-profiles} | tail -2)
  fi
''