2023-03-25 16:23:42 +01:00
|
|
|
{ config, lib, ... }:
|
2023-01-17 00:34:56 +01:00
|
|
|
|
|
|
|
{
|
|
|
|
options.nix = {
|
2023-01-17 02:14:18 +01:00
|
|
|
deleteChannels = lib.mkEnableOption "" // { description = "Whether to delete all channels on a system switch."; };
|
2023-01-17 00:34:56 +01:00
|
|
|
|
2023-03-25 16:23:42 +01:00
|
|
|
deleteUserProfiles = lib.mkEnableOption "" // { description = "Whether to delete all user profiles on a system switch."; };
|
2023-01-17 00:34:56 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
config = {
|
2023-01-17 02:12:16 +01:00
|
|
|
system.activationScripts = {
|
2023-01-17 00:34:56 +01:00
|
|
|
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*
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|