Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulseaudio: enable by default in NixOS if sound is enabled #29250

Closed
wants to merge 2 commits into from

Conversation

aristidb
Copy link
Contributor

Motivation for this change

I think PulseAudio should be enabled by default. This is because I think it is the better supported option nowadays, and because it is easier to set up than ALSA.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • [N/A] macOS
    • [N/A] Linux
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@aristidb
Copy link
Contributor Author

Feedback from IRC: Should this really be enabled by default on headless servers?

I think that's a valid concern, perhaps it should only be enabled if X11 is enabled?

@copumpkin
Copy link
Member

Definitely don't want it on my headless servers. I use the minimal.nix profile on my servers, which uses the no-x-libs.nix module. Not sure if there are better places to latch into it all.

@oxij
Copy link
Member

oxij commented Sep 12, 2017 via email

@Mic92
Copy link
Member

Mic92 commented Sep 12, 2017

Strange I cannot remember having configured something with pulseaudio except enabling it - Am I just lucky for the last 5 years?
Some ignorant question of mine since I did not use ALSA for a while:

  • Most laptops have at least 2 "soundcards" these days for HDMI and analog audio. Is switching between both easily possible?
  • Can ALSA in the configuration we have on NixOS set the volume level per application?
  • What about Bluetooth headset support for ALSA these days?

The network feature of pulseaudio is really cool btw - and it is not enabled by default. We have a Raspberry attached to the sound system and to play music on it, you just can use any pulseaudio application like that: PULSE_SERVER=<IP> mpv <FILE>

Is it documented in our manual how to enable pulseaudio? I think this is what we should at least do.

@7c6f434c
Copy link
Member

Unfortunately, whatever we do with Firefox build configuration, Pulseaudio is closer and closer to being required for sound support there. As I am running Firefox inside a separate UID, I run user-level Pulseaudio just for that user. (No opinion on NixOS setting beyond options being available, as I am not using that part of NixOS services in any case).

@oxij
Copy link
Member

oxij commented Sep 12, 2017 via email

@oxij
Copy link
Member

oxij commented Sep 12, 2017 via email

@7c6f434c
Copy link
Member

7c6f434c commented Sep 12, 2017 via email

@aristidb
Copy link
Contributor Author

Pulseaudio also supports some other things that ALSA doesn't, like Bluetooth Audio support (not sure how well that works right now, been a while since I've had a Bluetooth headset), and I've generally had the impression that it's better supported by applications nowadays - like @7c6f434c alludes to.

And dynamic source/sink switching is not an exotic feature at all.

Besides, @oxij - this PR is only about changing the default, nothing would prevent you from disabling it.

@aristidb
Copy link
Contributor Author

This latest change should disable it on headless machines that use minimal.nix, because for those, sound.enabled = false.

@oxij
Copy link
Member

oxij commented Sep 13, 2017 via email

@Mic92 Mic92 changed the title pulseaudio: enable by default in NixOS pulseaudio: enable by default in NixOS if sound is enabled Sep 13, 2017
@ghost
Copy link

ghost commented Oct 9, 2017

I don't see why this should be default. I use NixOS on desktop and nothing requires me to enable Pulse Audio.

@wizeman wizeman closed this Oct 30, 2017
@wizeman wizeman deleted the pulseaudio-by-default branch October 30, 2017 15:20
@grahamc grahamc restored the pulseaudio-by-default branch October 30, 2017 15:55
@aristidb
Copy link
Contributor Author

What is going on? PR closed without comment, then branch deleted and re-created?

@wizeman
Copy link
Member

wizeman commented Oct 30, 2017

@aristidb: I accidentally deleted many branches due to a typo and GitHub closed their associated PRs automatically. @grahamc was able to restore many of them but GitHub doesn't seem to have reopened this (or other?) PR(s). Furthermore, I don't even know which PRs were auto-closed, so I can't even reopen them until someone comments on it. Sorry for the trouble!

@wizeman wizeman reopened this Oct 30, 2017
@orivej
Copy link
Contributor

orivej commented Oct 30, 2017

Furthermore, I don't even know which PRs were auto-closed, so I can't even reopen them until someone comments on it.

This was the only one.

@copumpkin
Copy link
Member

@orivej nope, I've seen several, unfortunately

@orivej
Copy link
Contributor

orivej commented Oct 31, 2017

@copumpkin You are right, I've received the notifications and did not pay attention. There were six more issues, but they are handled already.

@michalrus
Copy link
Member

michalrus commented Oct 31, 2017

@aristidb: I accidentally deleted many branches due to a typo and GitHub closed their associated PRs automatically. @grahamc was able to restore many of them but GitHub doesn't seem to have reopened this (or other?) PR(s). Furthermore, I don't even know which PRs were auto-closed, so I can't even reopen them until someone comments on it. Sorry for the trouble!” — @wizeman

d816010#commitcomment-25130391
e01bb0c#commitcomment-24975428
@peterhoeg

“Erm, why do we want to limit push access to the repo exactly? Liberal granting of the commit bit is a great policy IME.” — @shlevy

Because… people in general are not particularly good at being precise.

What do you think of these “two” cases, @shlevy? Should similar ones be consistently happening, or would it be better to limit them with help of a machine?

Also: https://botbot.me/freenode/nixos/search/?q=push+force 🙄

@7c6f434c
Copy link
Member

@michalrus PR backlog only grows with time. Less people with commit access → more load. Nobody would expect people under load to be more precise.

As for help of a machine — well, nobody so far has managed to convince people to move to a VCS that actually cares about integrity. At least all the branches anyone cares about long-term are force-push protected, or so I hope (but I only care about master and staging, so it is true for me).

I have no idea why people like to do PRs from branches inside NixOS/Nixpkgs, either. Member pushes can be allowed with one click for PR branches in forks anyway. One of the few things GitHub actually seems able to do w.r.t. permissions…

@michalrus
Copy link
Member

As for help of a machine — well, nobody so far has managed to convince people to move to a VCS that actually cares about integrity.

Maybe because people (with few notable exceptions) don’t seem to care about integrity. Programmers. ¯\_(ツ)_/¯

Let’s maybe look at our, oh, oh, so to say, neighbors. Tell me, people of Nixpkgs:

  • who has write access to Kernel’s master,
  • and whether you consider their development model scalable enough with:
    • 15k contributors,
    • and millions of lines of code,
    • and, arguably, at least an order of magnitude harder problems than defining how to package some software.

@7c6f434c
Copy link
Member

7c6f434c commented Oct 31, 2017

Kernel development model is not scalable. It is not scalable down. (It is also what created git, which fits kernel development and only kernel development just because the things git cannot do sanely are infeasible at kernel scale anyway)

@michalrus
Copy link
Member

michalrus commented Nov 1, 2017

because the things git cannot do sanely

Which things do you mean? =) Just curious.

I’ve seen with my very own eyes, how properly configured Git can keep hordes of very junior developers from doing silly things—just like the ones that are consistently happening in Nixpkgs (cf. that IRC log).

Oh, but you cannot change server side behavior (hooks) on the proprietary GitHub®™©, which is the real problem w/ keeping larger (à propos scaling down) projects under reasonable control here…

People will make mistakes, it’s unavoidable. It seems to me like we could be better off, if those mistakes weren’t blindly accepted by our central repo of choice, nay?

(ノ^_^)ノ

@disassembler
Copy link
Member

Please talk about the git/github/other unrelated topics on IRC, the mailing list or anywhere else :) Back to the issue at hand. It seems like most people are in agreement that pulse audio as the default isn't a good idea, and that we need some documentation for enabling pulse audio. @aristidb are you interested in documenting this?

@orivej
Copy link
Contributor

orivej commented Nov 1, 2017

It seems like most people are in agreement that pulse audio as the default isn't a good idea

With 4 people against and 4 for the default pulseaudio (counting comments and likes) this question is not decided; this shows only the lack of interest. Personally I'm for pulseaudio by default because (1) it obsoleted the need to configure sound by editing configuration files, which is particularly valuable for the users who don't know what pulseaudio or ALSA are; (and I was also quite happy when I could delete my .asoundrc instead of tweaking it for another application that did not play well with the current configuration); (2) ditto for using the console to configure sound (alsamixer) and launch graphical applications: "If you want to switch between two sound cards without using application options you can do that with ALSA_PCM_CARD environment variable" — this is a ridiculous and terrible desktop experience.

we need some documentation for enabling pulse audio

Do you mean a new section in the NixOS manual about the audio configuration? The option hardware.pulseaudio.enable is certainly documented.

@disassembler
Copy link
Member

I was going off @Mic92 comment "Is it documented in our manual how to enable pulseaudio? I think this is what we should at least do." That's a good question if this is something we really want in the manual or not. Maybe it makes more sense for a more in-depth howto beyond just enabling it to go on the wiki, since it really isn't reference material. As for what the decision is here, if we're not at a consensus I guess we leave the issue open for debate until more people speak up one way or another.

@aristidb
Copy link
Contributor Author

aristidb commented Nov 1, 2017

@disassembler I don't think there is consensus either way (the opponents are louder, but the number of votes is in favor of it), which is why I'm not merging this. But I'm also not interested in patching over the lack of sane defaults with documentation.

I'll just close this particular pull request, but if somebody wants to take it up, feel free to.

@aristidb aristidb closed this Nov 1, 2017
@peterhoeg
Copy link
Member

In my opinion, we should agree on what the guiding principles are. And assuming we agree that we should be giving the user the best possible experience with the least number of surprises, then anything that helps make things "Just Work" should be enabled.

The one key feature we need from pulseaudio is mixing for which we will need a piece of software for all the hardware that doesn't support hardware mixing. At this point in time, pulseaudio is that software. Of course if something better comes along that solves that problem, we should probably use that.

But not being able to play multiple streams is a no-go.

@orivej
Copy link
Contributor

orivej commented Nov 2, 2017

The one key feature we need from pulseaudio is mixing for which we will need a piece of software for all the hardware that doesn't support hardware mixing.

AFAIK ALSA does software mixing by default (when necessary) and in our configuration.

I should probably disable pulseaudio on my system and see how far it could go. The main usability issues I expect are that:

  • some applications will not be able to play or record audio (e.g. Skype)
  • it will not remember per-application volume levels between application restarts
  • it will not have per-application volume controls at all
  • it will not have an easy way to switch between internal and HDMI sound cards
  • it will not have an easy way to switch between internal and a USB sound card, and it will not switch back to internal when the USB card is disconnected
  • I won't be able to play one audio stream on multiple sound cards at once without editing configuration files

@peterhoeg
Copy link
Member

AFAIK ALSA does software mixing by default (when necessary) and in our configuration.

Are you sure about that? As I recall we need to set up a dmix device for that to happen and I cannot find any config that does that.

The other points you make are very valid - assuming we want sound to just work, pulseaudio really is our only option at this point in time.

@orivej
Copy link
Contributor

orivej commented Nov 2, 2017

Are you sure about that? As I recall we need to set up a dmix device for that to happen and I cannot find any config that does that.

@oxij has posted the config above (cat /nix/store/*-alsa-lib-1.1.4.1/share/alsa/pcm/default.conf), it appears to setup dmix; and ALSA wiki says:

NOTE: For ALSA 1.0.9rc2 and higher you don't need to setup dmix for analogue output. Dmix is enabled by default for soundcards which don't support hardware mixing. You still need to set it up for digital outputs.

@oxij
Copy link
Member

oxij commented Nov 2, 2017 via email

@ghost
Copy link

ghost commented Nov 4, 2017

@oxij

I have no other explanation for this except there exists The Church of
Poettering (if you didn't know: he is the primary author of all of those
daemons) that holds secret meetings where they plan how to spoil all
usable OSS software in the most gruesome way possible and how to
infiltrate other OSS projects to help in that noble goal.

Is it possible to trim down systemd to just init system (just pid 1 and nothing more)? I mean say goodbye to

  1. systemd-journald. Syslog should be used instead
  2. systemd-udevd. Udev should be provided separately
  3. systemd-logind. No real need for it

@peterhoeg
Copy link
Member

This conversation has become a little unproductive. Why don't we move this to the mailing list and stick to the issue at hand.

@oxij
Copy link
Member

oxij commented Nov 10, 2017 via email

@oxij
Copy link
Member

oxij commented Dec 7, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants