Screensharing and audio not working properly in hyprland/pipewire

Hello, I’m unable to make screensharing and audio work in hyprland with pipewire. With my current configuraion audio playback and recording don’t work, even though all expected devices are detected and pavucontrol shows that nothing is muted, is just that no audio is coming in or out. Screensharin only works the first instance, the second I get this error:

sep 12 13:13:34 nixos xdg-desktop-portal-hyprland[1563]: [ERR] [pipewire] no buffer in enqueue
sep 12 13:13:34 nixos xdg-desktop-portal-hyprland[1563]: [ERR] [pipewire] no buffer in enqueue
sep 12 13:21:55 nixos xdg-desktop-portal-hyprland[1563]: [ERR] [pipewire] no buffer in enqueue
sep 12 13:21:55 nixos xdg-desktop-portal-hyprland[1563]: [LOG] [screencopy/pipewire] Out of buffers
sep 12 13:29:40 nixos xdg-desktop-portal-hyprland[1563]: [ERR] [pipewire] no buffer in enqueue
sep 12 13:29:40 nixos xdg-desktop-portal-hyprland[1563]: [ERR] [pipewire] no buffer in enqueue
sep 12 13:57:18 nixos xdg-desktop-portal-hyprland[1563]: [LOG] [screencopy/pipewire] Out of buffers
sep 12 13:57:18 nixos xdg-desktop-portal-hyprland[1563]: [ERR] [pipewire] no buffer in enqueue

If I use systemctl --user restart pipewire, then audio playback works properly, but screensharing crashes with xdg-desktop-portal-hyprland.service: Main process exited, code=dumped, status=11/SEGV.

This is my all my display related configuration. Pulseaudio is present in my environment.systemPackages.

{
  programs = {
    hyprland.enable = true; # enable Hyprland
    hyprland.xwayland.enable = true;
  };

  services.xserver.enable = true;

  services.displayManager.sddm.enable = true;

  services.xserver.xkb = {
    layout = "us";
    variant = "";
  };

  services.printing.enable = true;

  # services.pipewire.enable = false;

  xdg.portal = {
    enable = true;   
    wlr.enable = true;
    # gtk portal needed to make gtk apps happy
    extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
  };

  # Enable PipeWire as the sound server (replaces PulseAudio)
  services.pipewire = {
    enable = true;
    alsa.enable = true;  # ALSA support
    audio.enable = true;
    pulse.enable = true;  # Provides PulseAudio compatibility layer
    alsa.support32Bit = true;  # Enable for 32-bit apps (if needed)
  };

  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;

  fonts = {
    packages = with pkgs; [
      (nerdfonts.override { fonts = [ "CascadiaCode" ]; })
    ];
    fontconfig = {
      enable = true;
      defaultFonts = {
        monospace = [ "CaskaydiaCove Nerd Font Mono" ];
      };
    };
  };

  services.xserver.videoDrivers = [ "nvidia" ];

  hardware.nvidia = {
    prime = {
      sync.enable = true;
      intelBusId = "PCI:0:2:0";
      nvidiaBusId = "PCI:1:0:0";
    };
    modesetting.enable = true;
    nvidiaSettings = true;
    package = config.boot.kernelPackages.nvidiaPackages.production;
  };
}

My system is a laptop running linux_x86_64 with an nvidia RTX4070.

why?​​​​​​​​​​​​​​​​​​​​​​​​