linux-builder: remove /nix/store external directory when disabled

When /nix/store internal directories get renamed, they just don't get
into the next version of your system closure and are thus no problem to
rename. But state in the system is a problem, as there is no process to
remov eit. Thus we need to do it ourselves.
This commit is contained in:
‮rekcäH nitraM‮ 2025-03-24 21:44:21 +01:00 committed by Michael Hoang
parent a175c68f3f
commit b8939c4fe4

View file

@ -159,7 +159,13 @@ in
'';
};
config = mkIf cfg.enable {
config = mkMerge [
(mkIf (!cfg.enable) {
system.activationScripts.preActivation.text = ''
rm -rf ${cfg.workingDirectory}
'';
})
(mkIf cfg.enable {
assertions = [
{
assertion = config.nix.enable;
@ -223,5 +229,6 @@ in
}];
nix.settings.builders-use-substitutes = true;
};
})
];
}