mirror of
https://github.com/SuperSandro2000/nixos-modules.git
synced 2024-06-02 14:29:23 +02:00
24 lines
790 B
Nix
24 lines
790 B
Nix
{ config, lib, ... }:
|
|
|
|
{
|
|
options.nix = {
|
|
deleteChannels = lib.mkEnableOption "" // { description = "Whether to delete all channels on a system switch."; };
|
|
|
|
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*
|
|
'';
|
|
};
|
|
};
|
|
}
|