Controlling pulseaudio on nixos

I can’t seem to get sound to work on nixos. Any pactl command results in:

Connection failure: Connection refused
pa_context_connect() failed: Connection refused

the sound related settings in configuration.nix are:

  sound.enable = true;
  hardware.pulseaudio.enable = true;

Any help appreciated.

1 Like

It never occurred to me to do what you did.

I have:

nixos-option sound.enable


In case anyone else has problems and stumbles on this question, my problem was solved by removing ~/.config/pulse. It was a symlink to a file that had since been deleted, which understandably caused problems.

Checking systemctl --failed --user showed that pulseaudio.service and pulseaudio.socket had failed. Checking journalctl --user -u pulseaudio.service had this line:

Oct 16 06:42:36 mars pulseaudio[7629]: E: [pulseaudio] core-util.c: Failed to create secure directory (/home/alex/.config/pulse): Too many levels of symbolic links

which made me go look at that.

1 Like