From 7aeacd1a5ab79b1209b81efd507c210c8919888b Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Wed, 19 Jul 2023 21:59:13 +0200 Subject: [PATCH] add nvd on activate --- hosts/bolle/default.nix | 1 + hosts/nord/default.nix | 1 + hosts/noximilien/default.nix | 1 + hosts/sopp/default.nix | 1 + profiles/upgrade-diff.nix | 13 +++++++++++++ users/pbsds/home/default.nix | 1 + users/pbsds/home/profiles/update-diff.nix | 10 ++++++++++ 7 files changed, 28 insertions(+) create mode 100644 profiles/upgrade-diff.nix create mode 100644 users/pbsds/home/profiles/update-diff.nix diff --git a/hosts/bolle/default.nix b/hosts/bolle/default.nix index 957b6c8..258f2a3 100644 --- a/hosts/bolle/default.nix +++ b/hosts/bolle/default.nix @@ -9,6 +9,7 @@ ./hardware-configuration.nix ../../hardware/gpu/intel.nix ../../profiles/auto-upgrade.nix + ../../profiles/upgrade-diff.nix ../../profiles/sshd.nix ../../users # home-manager diff --git a/hosts/nord/default.nix b/hosts/nord/default.nix index 763ef20..c8acfb6 100644 --- a/hosts/nord/default.nix +++ b/hosts/nord/default.nix @@ -18,6 +18,7 @@ ../../hardware/gpu/rocm.nix ../../hardware/gpu/intel.nix ../../profiles/auto-upgrade.nix + ../../profiles/upgrade-diff.nix ../../profiles/sshd.nix ../../users # home-manager diff --git a/hosts/noximilien/default.nix b/hosts/noximilien/default.nix index d764947..11fcb78 100644 --- a/hosts/noximilien/default.nix +++ b/hosts/noximilien/default.nix @@ -8,6 +8,7 @@ ./hardware-configuration.nix ../../hardware/gpu/intel.nix ../../profiles/auto-upgrade.nix + ../../profiles/upgrade-diff.nix ../../profiles/sshd.nix ../../profiles/podman.nix diff --git a/hosts/sopp/default.nix b/hosts/sopp/default.nix index 4139b8d..7bd3887 100644 --- a/hosts/sopp/default.nix +++ b/hosts/sopp/default.nix @@ -24,6 +24,7 @@ ../../hardware/gpu/intel.nix ../../hardware/printer/hp-laserjet-p1005.nix ../../profiles/auto-upgrade.nix + ../../profiles/upgrade-diff.nix ../../profiles/sshd.nix ../../profiles/no-suspend.nix ../../profiles/podman.nix diff --git a/profiles/upgrade-diff.nix b/profiles/upgrade-diff.nix new file mode 100644 index 0000000..5294321 --- /dev/null +++ b/profiles/upgrade-diff.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: +{ + + # nvd: https://discourse.nixos.org/t/nvd-simple-nix-nixos-version-diff-tool/12397 + # module from https://github.com/luishfonseca/dotfiles/blob/ab7625ec406b48493eda701911ad1cd017ce5bc1/modules/upgrade-diff.nix + system.activationScripts.diff = { + supportsDryActivation = true; + text = '' + ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig" + ''; + }; + +} diff --git a/users/pbsds/home/default.nix b/users/pbsds/home/default.nix index b5f477a..a4fe141 100644 --- a/users/pbsds/home/default.nix +++ b/users/pbsds/home/default.nix @@ -12,6 +12,7 @@ ./profiles/shell.nix ./profiles/ssh.nix ./profiles/tmate.nix + ./profiles/update-diff.nix ]; # TODO: add remote-exec once packaged diff --git a/users/pbsds/home/profiles/update-diff.nix b/users/pbsds/home/profiles/update-diff.nix new file mode 100644 index 0000000..4aa195c --- /dev/null +++ b/users/pbsds/home/profiles/update-diff.nix @@ -0,0 +1,10 @@ +{ config, pkgs, ... }: +{ + + # nvd: https://discourse.nixos.org/t/nvd-simple-nix-nixos-version-diff-tool/12397 + # module from https://infosec.exchange/@wyndon/110662698348958506 + home.activation.diff-update = config.lib.dag.entryAnywhere '' + ${pkgs.nvd}/bin/nvd diff $oldGenPath $newGenPath + ''; + +}