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
nixos: disable sound by default, if stateVersion >= 18.03 #35355
Conversation
@@ -78,7 +77,9 @@ in | |||
|
|||
###### implementation | |||
|
|||
config = mkIf config.sound.enable { | |||
config = { | |||
sound.enable = mkDefault !(versionAtLeast config.system.stateVersion "18.03") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you need a ;
at the end of this line
config = mkIf config.sound.enable { | ||
config = { | ||
sound.enable = mkDefault !(versionAtLeast config.system.stateVersion "18.03") | ||
} // mkIf config.sound.enable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure, but you might need to wrap the mkIf config.sound.enable { ... }
in (...)
.
Try testing it like this: |
Agree in principle, strongly against in practice:
- Breaks existing configurations.
- Headless and speakerless systems disable it anyway.
- Saves only about 2.3Mb (can be made ~828K if we separate outputs of `alsa-utils`) anyway.
|
How does this break existing configurations? Are people deleting the |
Also, what is #35319?
|
@oxij Thanks for point out the other PR that I missed. |
How does this break existing configurations? Are people deleting the `do-not-touch` `stateVersion` from their configuration? If so, I'm okay with that and we should move forward.
I use and continuously update the same `configuration.nix` from around 7 years ago (and "reinstall" by simply copying system closure to a new HDD). My configuration does not contain such a line.
|
I understand. I'm okay with this level of breakage, as the stateVersion has been around for several years now, is well documented, and long time users have had several opportunities (and will have another opportunity) to catch this problem via the release notes before their configuration breaks. |
I understand. I'm okay with this level of breakage, as the stateVersion has been around for several years now, is well documented, and long time users have had several opportunities (and will have another opportunity) to catch this problem via the release notes before their configuration breaks.
Ugh, can't we at the very least generate a warning if you don't have `stateVersion` set? Surely I'm not alone here.
Now, as to the implementation.
```
+ # Enable sound.
+ # sound.enable = true;
+ # hardware.pulseaudio.enable = true;
+
```
`hardware.pulseaudio.enable = true;` line is out of scope of this PR and belongs to the discussion of #35292. Lets not repeat all of that here. "Hey, its just a comment" is not an argument. I'm absolutely serious. Please, remove that line.
```
- config = mkIf config.sound.enable {
+ config = {
+ sound.enable = mkDefault (!versionAtLeast config.system.stateVersion "18.03");
+ } // mkIf config.sound.enable {
```
This is ugly and probably won't work (lacks parens). Why don't you just put that expression into the `default = ` where it belongs? The manual build can then be made deterministic again by defining `defaultText`.
|
@oxij Your aggressive style is not appreciated. |
How is any of the above aggressive?
|
I've fixed the error of how I was using mkIf in 473cfed (my nixos module system skills are rusty :(), and the missing defaultText in f372898. Fortunately, this will all be squash-merged, so nobody will have to look at my erroneous intermediate commits. Now I'm waiting for @fpletz and @vcunat to say what they think about getting this into 18.03. |
... and then most of my substantial comments were ignored =/
See oxij@42a814e instead.
|
Same thing, but with warnings and no sneaky changes: #35366. |
Jan, Let me start with recognizing that you don't care for PulseAudio and As an organizational goal, the NixOS system defaults should do a nice In the case of Firefox, indeed -- upstream expects PulseAudio and In the case of users, because NixOS has no sort of metrics collection It seems to be a very common opinion that NixOS should in fact enable However, my position on PulseAudio is not what I'm writing this for, Firstly: it is not appropriate to compare a configuration setting Secondly: a much easier way to explain the PRs around enabling People have different opinions from you, and that is okay. This is a When people do things you disagree with, it is not stupid. When people Franz is not lying when he interprets his experience and observations Finally, nobody is forcing you to use any software. You can choose to If you truly believe NixOS contributors are crazy, lying, and Thank you, |
=/ Well.
Let me start with recognizing that you don't care for PulseAudio and possibly the entire FreeDesktop software universe.
...
I do care about PulseAudio, I care about it so much that I read its source and, as you see, now put a lot of effort into trying to prevent it ever running on as many machines as possible.
Anyway.
I apologize if I offended anyone, as that was not my intention (never ever felt such an intention in my life). But, please try to look at what happens to NixOS from my point of view. Lets forget about issues with systemd, use-flags and SLNOS even.
So, I follow GitHub issues and look into `git log -p --grep pulseaudio` (seriously, just look at the log) and see this constant push for PulseAudio by default. I ask myself "Why is that?" I see three possibilities: I simply don't understand something, incompetence, malice. So I ask technical questions like "why do you even need it? and why do you need to link against libpulseaudio in apps that support ALSA when they would work via ALSA->PA adapter anyway?`. And get no answers. Instead I get ignored and PRs get merged. So I make a PR that goes the other direction (#35041), and get 👎s that cite same factually incorrect technical arguments.
Note that in the recently merged #35005 and ignored #35041 I'm exactly concerned that people will use arguments of #35292 for PulseAudio by default.
Then, just as #35005 gets merged, I see #35292 pop up after the long discussion of #29250 (and by the same author as #29250!) using exactly the arguments I was concerned about. I thought I were dreaming, but I were not.
Then this PR gets split off out of #35292, and instead of doing what it states, it also sneaks in a change that suggests you need to run PulseAudio by default to get sound.
Yes, I got triggered by this. Would you not be?
upstream software
Right. Do you remember #29250 where I said
$ cd nixpkgs/pkgs
$ ag alsaLib | cut -d ':' -f1 | sort | uniq > alsa
$ ag libpulse | cut -d ':' -f1 | sort | uniq > pulse
$ cat alsa pulse | sort | uniq -d > both
$ wc -l alsa pulse both
272 alsa
139 pulse
87 both
So, ~185 expressions mentioning ALSA without libpulse, ~52 expressions
mentioning libpulse without ALSA. I think we have a clear winner in
"better supported by applications" category.
What are your counterarguments? Sure, there is n=1 of firefox, but after what they did with their 'Mr. Robot "study"' and having read PA code myself I now can't interpret their
nobody wants to support it [PulseAudio] and we don't have time to do it
as anything but malice (sorry to all the honest firefox devs, but what else do you expect me to do here?).
a very common option to enable, so lets do it by default
I agree that it is a common option, but
- it is much more common to leave everything to the defaults,
- most people that do enable PA simply don't know better, it's highly improbable that they actually need any of its features ALSA doesn't provide already, but they expose themselves to a huge security liability.
Just as an experiment, run
```
$ grep 'gstreamer.*bad' pkgs
```
Every app that has `gstreamer-plugins-bad` and feeds them from the network (e.g. `liferea`) is a security liability (I planned to PR SLNOS fix for this eventually, but now I wonder if I should even try). They are called "-bad" for a reason, look it up if you don't believe me. If you look at PA's internals, you'll understand my concern with this whole thing. _It's exactly the same problem._
Personally, I think that making or even suggesting to users to run PA by default and especially to connect it to networking software like `firefox` is simply ethically unacceptable.
Should I've said "NSA", "KGB", "an advanced persistent threat" instead of "Stasi"? I don't care about the pleasantries. I care about technical details. Connecting PA to untrusted data sources is madness and anyone willingly pushing it is either underinformed, crazy or malicious. No offense intended.
Your behavior on these recent pull requests have distressed, upset, and frustrated fellow members of the community.
Again, I apologize. Mental institutions part, indeed, was a bit too much. But the sequence of "let's enable pulseaudio by default" and "let's disable sound by default unless pulseaudio is enabled" got me flipping my tea table here, so, I think, you have to understand and pardon that paragraph.
Firstly: it is not appropriate to compare a configuration setting about sound to the Stasi, or a re-framing of a poem about the systematic extermination of people.
I disagree. I think it was appropriate. That poem is about social responsibility. Not connecting PA to the net in a social responsibility to our users.
Secondly: ...
Addressed above.
When people do things you disagree with, it is not stupid. ...
Addressed above.
Franz is not lying when he interprets his experience and observations and concludes that most NixOS users are using PulseAudio. It is not appropriate to accuse well-meaning core contributors of lying.
Franz, I apologize, I did not mean that you were lying.
I was writing that part just after I flipped the tea table, and, indeed, it turned out to be ambiguous.
I purely meant that I think that Mozilla are deliberately (again, sorry to all the honest mozilla devs) misleading with their interpretation of the usage stats they collect, nothing else.
Note, that my general statistical observations from that part still are not addressed. Thus, I think, that even if we ignore all of the above, the argument "normal users want this by default" is not as clear as you present it to be. Just sayin'.
SLNOS
Unrelated. This is a purely technical discussion.
Otherwise, please tone down your rhetoric and cease with the personal attacks.
I did not personally attack anyone, I never personally attack anyone, I attacked their patches that I find malicious. Surely, most of the "advanced persistent threats" and nixpkgs contributors are good people that pursue noble goals (state security and convenience for users respectively). But I don't care if they are good people or if their goals are noble when by following their goals they expose normal people to security and privacy threats.
I think this is simply ethically unacceptable.
|
Hm, this is not really the intended use of
So this is only intended for options that have some corresponding on-disk state. AFAICT this is not the case for sound. In any case I had some vague recollection that we also had a |
@@ -603,6 +603,10 @@ sub multiLineList { | |||
# Enable CUPS to print documents. | |||
# services.printing.enable = true; | |||
|
|||
# Enable sound. | |||
# sound.enable = true; | |||
# hardware.pulseaudio.enable = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BTW, shouldn't hardware.pulseaudio.enable = true
imply sound.enable = true
? Or perhaps the other way around, if we want Pulseaudio to be the default sound system.
BTW, shouldn't `hardware.pulseaudio.enable = true` imply `sound.enable = true`? Or perhaps the other way around, if we want Pulseaudio to be the default sound system.
They are independent.
`sound.enable = true` makes `asound.conf` and runs ALSA services, `hardware.pulseaudio.enable = true` makes its own `asound.conf` with ALSA->PA adapter and runs PA services.
|
Maybe the defaults would better be solved along these lines: {
# X, pulseaudio, ...
imports = [ <nixpkgs/nixos/modules/profiles/desktop.nix> ];
} |
Probably a good idea to point to this #35292 (comment) here too. |
Linking e349ccc#commitcomment-27757112 here as I'm fairly concerned about making this change unconditionally -- it would break every NixOS desktop's user sound after an update, which IMO is not justified by a small closure size benefit in default server setups. |
it would break every NixOS desktop's user sound after an update, which IMO is not justified by a small closure size benefit in default server setups.
Exactly my original concern in the parent thread and above here. Thanks for chipping in.
I still think this should be reverted.
|
To be clear I was okay with this change as long as it was conditional on some variable which specifies how "modern" is current NixOS configuration. However I also agree with @edolstra that Offtopic: @oxij made a good point that we should warn if |
@oxij Yeah, I actually wanted to propose you to split |
Let me remind you that after this was reverted the ALSA module is now broken by default. If you don't want to revert the original change, let's make a warning at the very least. See #46490. |
Motivation for this change
This change was suggested by @fpletz in #35292. Sound is disabled by default (for stateVersion > 18.03), and nixos-generate-config now puts a helpful comment telling you how to enable it. This is consistent with X11 being disabled by default.
Things done
I'm still building the branch, so not ready yet with everything. I wanted to create the PR already to enable discussion.
build-use-sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)