about summary refs log tree commit diff stats
path: root/modules/system
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-11 18:01:38 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-10-11 18:01:38 +0200
commitacda6315ad06c2597a8747e45a577da2c4216735 (patch)
tree7dda432e19c6c4ecadcc914f5b28ad953b4f06b7 /modules/system
parentbuild(treewide): Update (diff)
downloadnixos-config-acda6315ad06c2597a8747e45a577da2c4216735.tar.gz
nixos-config-acda6315ad06c2597a8747e45a577da2c4216735.zip
feat(services/diffSystem): Init
Diffstat (limited to '')
-rw-r--r--modules/system/services/default.nix1
-rw-r--r--modules/system/services/system_diff/default.nix26
2 files changed, 27 insertions, 0 deletions
diff --git a/modules/system/services/default.nix b/modules/system/services/default.nix
index 76ef26e2..b5d500bd 100644
--- a/modules/system/services/default.nix
+++ b/modules/system/services/default.nix
@@ -14,6 +14,7 @@
     ./snapper
     ./steam
     ./swaylock
+    ./system_diff
     ./xdg
   ];
 }
diff --git a/modules/system/services/system_diff/default.nix b/modules/system/services/system_diff/default.nix
new file mode 100644
index 00000000..052ffae2
--- /dev/null
+++ b/modules/system/services/system_diff/default.nix
@@ -0,0 +1,26 @@
+{
+  config,
+  lib,
+  pkgs,
+  ...
+}: let
+  cfg = config.soispha.services.systemDiff;
+in {
+  options.soispha.services.systemDiff = {
+    enable = lib.mkEnableOption "nvd run at system activation";
+  };
+
+  config = lib.mkIf cfg.enable {
+    system.activationScripts.diff = {
+      supportsDryActivation = true;
+      text = ''
+        PATH="${lib.makeBinPath [pkgs.nvd config.nix.package]}:$PATH"
+
+        if [ -e /run/current-system ]; then
+          # ${lib.getExe config.nix.package} --extra-experimental-features nix-command store diff-closures /run/current-system "$systemConfig"
+          nvd diff $(ls -dv /nix/var/nix/profiles/system-*-link | tail -2)
+        fi
+      '';
+    };
+  };
+}