nixos/grub: Refactor perl script to remove the Switch module