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

nix: add settings to cleanup legacy, none flake things

This commit is contained in:
Sandro - 2023-01-17 00:34:56 +01:00
parent 7e98f19f5d
commit dd49629a06
Signed by: sandro
GPG Key ID: 3AF5A43A3EECC2E5

23
modules/nix.nix Normal file
View File

@ -0,0 +1,23 @@
{ config, lib, libS, ... }:
{
options.nix = {
deleteChannels = lib.mkEnableOption "" // { description = "Wether to delete all channels on a system switch."; };
deleteUserProfiles = lib.mkEnableOption "" // { description = "Wether to delete all channels on a system switch."; };
};
config = {
system.userActivationScripts = {
deleteChannels = lib.mkIf config.nix.deleteChannels ''
echo "Deleting all channels..."
rm -rf /root/.nix-channels /home/*/.nix-channels /nix/var/nix/profiles/per-user/*/channels*
'';
deleteUserProfiles = lib.mkIf config.nix.deleteUserProfiles ''
echo "Deleting all user profiles..."
rm -rf /root/.nix-profile /home/*/.nix-profile /nix/var/nix/profiles/per-user/*/profile*
'';
};
};
}