summaryrefslogtreecommitdiff
path: root/modules/nixos/traits/nvd-diff.nix
blob: 4c59287f87ac9acd5e66fb8aa22e1ddfb4c67052 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  config,
  lib,
  pkgs,
  ...
}:
let
  cfg = config.traits.nvd-diff;
in
{
  options.traits.nvd-diff = {
    enable = lib.mkEnableOption "showing configuration diffs with NVD on upgrade" // {
      default = true;
    };
  };

  config = lib.mkIf cfg.enable {
    system.activationScripts."upgrade-diff" = {
      supportsDryActivation = true;
      text = ''
        ${lib.getExe pkgs.nvd} \
          --nix-bin-dir=${config.nix.package}/bin \
          diff /run/current-system "$systemConfig"
      '';
    };
  };
}