2023-08-17 13:40:42 +02:00
|
|
|
# MIT Jörg Thalheim - https://github.com/Mic92/dotfiles/blob/c6cad4e57016945c4816c8ec6f0a94daaa0c3203/nixos/modules/upgrade-diff.nix
|
2024-05-28 17:01:27 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
2023-08-17 13:40:42 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
options.components.nixos.update-diff.enable = lib.mkOption {
|
|
|
|
type = lib.types.bool;
|
|
|
|
default = config.components.nixos.enable;
|
|
|
|
};
|
|
|
|
|
|
|
|
config = lib.mkIf (config.components.nixos.update-diff.enable) {
|
|
|
|
system.activationScripts.diff = {
|
|
|
|
supportsDryActivation = true;
|
|
|
|
text = ''
|
|
|
|
if [[ -e /run/current-system ]]; then
|
|
|
|
echo "--- diff to current-system"
|
2024-05-28 17:01:27 +02:00
|
|
|
${pkgs.nvd}/bin/nvd --nix-bin-dir=${config.nix.package}/bin diff /run/current-system "$systemConfig"
|
2023-08-17 13:40:42 +02:00
|
|
|
echo "---"
|
|
|
|
fi
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|