diff --git a/home-manager/roles/default.nix b/home-manager/roles/default.nix index f4e843db..3a34e123 100644 --- a/home-manager/roles/default.nix +++ b/home-manager/roles/default.nix @@ -7,6 +7,7 @@ ./unlock.nix ./mpclient.nix ./neovim + ./nvd.nix ]; nixpkgs.overlays = import ../../overlays { inherit lib; }; diff --git a/home-manager/roles/nvd.nix b/home-manager/roles/nvd.nix new file mode 100644 index 00000000..89d64e6b --- /dev/null +++ b/home-manager/roles/nvd.nix @@ -0,0 +1,9 @@ +{ config, pkgs, lib, ... }: +with lib; +let + dag = config.lib.dag; + nvd = import pkgs.sources.nvd { inherit pkgs; }; +in +{ + home.activation.report-changes = dag.entryAnywhere "${nvd}/bin/nvd $oldGenPath $newGenPath"; +} diff --git a/lib/update-system.nix b/lib/update-system.nix index ae31e025..9f7edaa4 100644 --- a/lib/update-system.nix +++ b/lib/update-system.nix @@ -1,9 +1,11 @@ { pkgs, nixos-rebuild }: -let configPath = "/etc/nixos"; -in { +let + configPath = "/etc/nixos"; +in +{ update-system = pkgs.writeHaskellScript { name = "update-system"; - bins = [ nixos-rebuild pkgs.nix-output-monitor ]; + bins = [ nixos-rebuild pkgs.nix-output-monitor (import pkgs.sources.nvd { inherit pkgs; }) ]; } '' main = do paths <- myNixPath "${configPath}" @@ -11,6 +13,9 @@ in { setEnv "WITH_SECRETS" "false" nom_build (paths ++ buildSystemParams ++ ["--no-out-link"] ++ remoteBuildParams ++ fmap toString args) setEnv "WITH_SECRETS" "true" + oldSystem <- readlink "-f" "/run/current-system" |> captureTrim nixos_rebuild (paths ++ ["switch"] ++ fmap toString args) &!> StdOut |> nom + newSystem <- readlink "-f" "/run/current-system" |> captureTrim + nvd oldSystem newSystem ''; } diff --git a/nix/sources.json b/nix/sources.json index bb1d5f7d..32b74ebb 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -99,6 +99,12 @@ "url": "https://github.com/NixOS/nixpkgs/archive/294d1925af6462e55c76b49624b983036f0093b9.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "nvd": { + "branch": "master", + "repo": "https://gitlab.com/khumba/nvd.git", + "rev": "7cdaa6d818119bd7a51930d990fded5d594c6623", + "type": "git" + }, "obelisk": { "branch": "master", "description": "Obelisk provides an easy way to develop and deploy your Reflex project for web and mobile",