22
0
mirror of https://github.com/SuperSandro2000/nixos-modules.git synced 2024-06-02 14:29:23 +02:00

nix: add diffSystem

This commit is contained in:
Sandro - 2023-10-16 16:47:10 +02:00
parent 085931181b
commit 37eae5f085
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5

View File

@ -9,6 +9,8 @@ in
deleteUserProfiles = lib.mkEnableOption "" // { description = "Whether to delete all user profiles on a system switch."; };
diffSystem = lib.libS.mkOpinionatedOption "system closure diffing on updates";
remoteBuilder = {
enable = lib.mkEnableOption "restricted nix remote builder";
@ -67,6 +69,16 @@ in
echo "Deleting all user profiles..."
rm -rf /root/.nix-profile /home/*/.nix-profile /nix/var/nix/profiles/per-user/*/profile* || true
'';
diff-system = lib.mkIf cfg.diffSystem {
supportsDryActivation = true;
text = ''
if [[ -e /run/current-system && -e $systemConfig ]]; then
echo System package diff:
${lib.getExe config.nix.package} store diff-closures /run/current-system $systemConfig || true
fi
'';
};
};
};
}