HiDPI and Wayland

I recently moved from Manjaro+X11 (i3) to NixOS+Wayland (Sway). My cursor was too small on a HiDPI screen. Here's how I solved it:

Install a theme, doesn't matter which

Install numix-cursor-theme. In my system flake this package is added to users.users.<name>.packages. If you're not on NixOS you'll need to use another way of getting a cursor theme. I don't know if nix profile install nixpkgs#numix-cursor-theme will work.

Firefox

Install firefox-wayland from nixpkgs. If you are not using Nix or somehow don't have access to firefox-wayland then you can set export MOZ_ENABLE_WAYLAND=1, as this appears to be what firefox-wayland wraps the normal firefox with.

Now use the gsettings command to change the database in ~/.config/dconf/user, which firefox apparently reads. Firefox should immediately respond to the changes and show a different cursor (or crash, as happened in my case).

nix shell nixpkgs#glib
gsettings set org.gnome.desktop.interface cursor-theme Numix-Cursor-Light
gsettings set org.gnome.desktop.interface cursor-size 64

If firefox doesn't immediately respond then just try to restart it or sway. This happened a couple of times in my case.

Persistent configuration

I added glib to my nix user packages and added the above commands to sway's configuration:

exec --no-startup-id gsettings set org.gnome.desktop.interface cursor-theme Numix-Cursor-Light
exec --no-startup-id gsettings set org.gnome.desktop.interface cursor-size 64

Dark Theme & Scaling firefox

Might as well add this while I'm on the topic (since I found it a bit hard to find theming information myself). To make the firefox UI dark, install matcha-gtk-theme and set:
export GTK_THEME=Matcha-dark-sea
To scale the firefox UI go to about:config and set:
layout.css.devPixelsPerPx = 2

Alacritty

Alacritty uses the environment variables:
export XCURSOR_SIZE=64
export XCURSOR_THEME=Numix-Cursor-Light
We can also add this to sway's config:
seat seat0 xcursor_theme Numix-Cursor-Light 64
The above will set the aforementioned environment variables.

Extra

To zoom in Sway (HiDPI), set:
output * scale 2