about summary refs log tree commit diff stats
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
parentbuild(treewide): Update (diff)
downloadnixos-config-acda6315ad06c2597a8747e45a577da2c4216735.tar.gz
nixos-config-acda6315ad06c2597a8747e45a577da2c4216735.zip
feat(services/diffSystem): Init
-rw-r--r--hosts/apzu/default.nix1
-rw-r--r--hosts/tiamat/default.nix1
-rw-r--r--modules/system/services/default.nix1
-rw-r--r--modules/system/services/system_diff/default.nix26
4 files changed, 29 insertions, 0 deletions
diff --git a/hosts/apzu/default.nix b/hosts/apzu/default.nix
index 2d26b27b..def21291 100644
--- a/hosts/apzu/default.nix
+++ b/hosts/apzu/default.nix
@@ -49,6 +49,7 @@
       scanning.enable = true;
       snapper.enable = true;
       steam.enable = false;
+      systemDiff.enable = true;
     };
     sound.enable = true;
     tempfiles.enable = true;
diff --git a/hosts/tiamat/default.nix b/hosts/tiamat/default.nix
index 17e2ae9d..11bb0b70 100644
--- a/hosts/tiamat/default.nix
+++ b/hosts/tiamat/default.nix
@@ -55,6 +55,7 @@
       snapper.enable = true;
 
       steam.enable = false;
+      systemDiff.enable = true;
     };
     locale = {
       enable = true;
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
+      '';
+    };
+  };
+}