22
0
mirror of https://github.com/SuperSandro2000/nixos-modules.git synced 2024-06-11 02:34:05 +02:00
nixos-modules/modules/nix.nix

24 lines
790 B
Nix
Raw Normal View History

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