From 8aff5306fc91f664ce302dc2981cf98463beb623 Mon Sep 17 00:00:00 2001 From: Sergei Bulavintsev Date: Mon, 4 Mar 2024 15:43:51 +0300 Subject: [PATCH] feat(nix): enable nvd diff output --- nix/modules/darwin/nix/default.nix | 10 ++++++++++ nix/modules/nixos/system/nix/default.nix | 7 +++++++ 2 files changed, 17 insertions(+) diff --git a/nix/modules/darwin/nix/default.nix b/nix/modules/darwin/nix/default.nix index 789805a..5ad62ee 100644 --- a/nix/modules/darwin/nix/default.nix +++ b/nix/modules/darwin/nix/default.nix @@ -20,6 +20,7 @@ in { nixfmt nix-index nix-prefetch-git + nvd ]; nix = let @@ -68,5 +69,14 @@ in { generateNixPathFromInputs = true; linkInputs = true; }; + system.activationScripts.postUserActivation = + { + text = '' + ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig" + ''; + } + // lib.optionalAttrs pkgs.stdenv.isLinux { + supportsDryActivation = true; + }; }; } diff --git a/nix/modules/nixos/system/nix/default.nix b/nix/modules/nixos/system/nix/default.nix index 33ae4fe..9619c45 100644 --- a/nix/modules/nixos/system/nix/default.nix +++ b/nix/modules/nixos/system/nix/default.nix @@ -26,6 +26,7 @@ in { nixfmt nix-index nix-prefetch-git + nvd ]; nix = let @@ -65,5 +66,11 @@ in { generateNixPathFromInputs = true; linkInputs = true; }; + system.activationScripts.diff = { + supportsDryActivation = true; + text = '' + ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig" + ''; + }; }; }