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

nixos: disable sound by default, if stateVersion >= 18.03 #35355

Merged
merged 5 commits into from Feb 22, 2018

Conversation

aristidb
Copy link
Contributor

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.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • 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

CC @fpletz @vcunat @grahamc

@@ -78,7 +77,9 @@ in

###### implementation

config = mkIf config.sound.enable {
config = {
sound.enable = mkDefault !(versionAtLeast config.system.stateVersion "18.03")
Copy link
Member

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 {
Copy link
Member

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 (...).

@grahamc
Copy link
Member

grahamc commented Feb 22, 2018

Try testing it like this: HOME=/homeless-shelter NIX_PATH=nixpkgs=$(pwd) nix-instantiate ./nixos/release.nix -A options --option restrict-eval true --option build-timeout 1800 --argstr system x86_64-linux --show-trace

@oxij
Copy link
Member

oxij commented Feb 22, 2018 via email

@grahamc
Copy link
Member

grahamc commented Feb 22, 2018

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.

@oxij
Copy link
Member

oxij commented Feb 22, 2018 via email

@aristidb
Copy link
Contributor Author

@oxij Thanks for point out the other PR that I missed.

@oxij
Copy link
Member

oxij commented Feb 22, 2018 via email

@grahamc
Copy link
Member

grahamc commented Feb 22, 2018

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.

@aristidb aristidb closed this Feb 22, 2018
@aristidb aristidb reopened this Feb 22, 2018
@oxij
Copy link
Member

oxij commented Feb 22, 2018 via email

@aristidb
Copy link
Contributor Author

@oxij Your aggressive style is not appreciated.

@oxij
Copy link
Member

oxij commented Feb 22, 2018 via email

@aristidb
Copy link
Contributor Author

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.

@oxij
Copy link
Member

oxij commented Feb 22, 2018 via email

@oxij
Copy link
Member

oxij commented Feb 22, 2018

Same thing, but with warnings and no sneaky changes: #35366.

oxij pushed a commit to oxij/nixpkgs that referenced this pull request Feb 22, 2018
@grahamc
Copy link
Member

grahamc commented Feb 22, 2018

How is any of the above aggressive?

Jan,

Let me start with recognizing that you don't care for PulseAudio and
possibly the entire FreeDesktop software universe. You have made your
opinion of Poettering quite clear. I appreciate your position on
this, and respect your choice.

As an organizational goal, the NixOS system defaults should do a nice
job representing a common, well supported base system to work off of.
It is especially nice when this default also matches what most users
are already using, and what upstream software writers are expecting.

In the case of Firefox, indeed -- upstream expects PulseAudio and
we're inclined to follow that lead. NixOS does not have the user base
or contributor base to put up a meaningful resistance to far-reaching
ecosystem changes like this.

In the case of users, because NixOS has no sort of metrics collection
mechanism, it is much harder to tell. However, anecdotally, it is
a very common option to enable -- present in most public
configurations and tutorials I've come across.

It seems to be a very common opinion that NixOS should in fact enable
PulseAudio if sound is enabled by default, and indeed I also support
that position.

However, my position on PulseAudio is not what I'm writing this for,
it is more about your approach to communicating about the issue. Your
behavior on these recent pull requests have distressed, upset, and
frustrated fellow members of the community.

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.

Secondly: a much easier way to explain the PRs around enabling
PulseAudio is that it is considered an improvement to the defaults.
Not an attack upon you, not conspiracy against you.

People have different opinions from you, and that is okay. This is a
beautiful part of the NixOS configuration mechanism!

When people do things you disagree with, it is not stupid. When people
do things you disagree with, it is not crazy. It is not appropriate to
question a fellow contributor's mental fitness because you don't care
for the work they've done.

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.

Finally, nobody is forcing you to use any software. You can choose to
not use NixOS. In a lot of ways, you already have -- by making SLNOS.
NixOS has no intentions of making SLNOS hard to maintain, and at the
same time NixOS is not beholden to making it easy or convenient for
SLNOS to exist.

If you truly believe NixOS contributors are crazy, lying, and
conspiring against you, then I wholeheartedly recommend you avoid
such a toxic environment. Otherwise, please tone down your rhetoric
and cease with the personal attacks.

Thank you,
Graham

@fpletz fpletz added this to the 18.03 milestone Feb 22, 2018
@fpletz fpletz changed the title nixos: disable sound by default, if stateVersion > 18.03 nixos: disable sound by default, if stateVersion >= 18.03 Feb 22, 2018
@fpletz fpletz merged commit a43e33d into master Feb 22, 2018
@fpletz fpletz deleted the sound-disabled-by-default branch February 22, 2018 22:06
@oxij
Copy link
Member

oxij commented Feb 23, 2018 via email

@edolstra
Copy link
Member

Hm, this is not really the intended use of stateVersion. From the description:

        Every once in a while, a new NixOS release may change
        configuration defaults in a way incompatible with stateful
        data. For instance, if the default version of PostgreSQL
        changes, the new version will probably be unable to read your
        existing databases. To prevent such breakage, you can set the
        value of this option to the NixOS release with which you want
        to be compatible. The effect is that NixOS will option
        defaults corresponding to the specified release (such as using
        an older version of PostgreSQL).

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 stateVersion is a necessary evil that only exists because we can't just upgrade Postgres databases or change SSH host keys. It's not necessary for things like whether sound is enabled. (If the user discovers that sound is suddenly disabled, they can just enable it.)

I had some vague recollection that we also had a configVersion option setting to control the defaults for non-state-related options, but I can't find it so maybe it was only discussed.

@@ -603,6 +603,10 @@ sub multiLineList {
# Enable CUPS to print documents.
# services.printing.enable = true;

# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
Copy link
Member

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.

@oxij
Copy link
Member

oxij commented Feb 23, 2018 via email

@vcunat
Copy link
Member

vcunat commented Feb 23, 2018

Maybe the defaults would better be solved along these lines:

{
  # X, pulseaudio, ...
  imports = [ <nixpkgs/nixos/modules/profiles/desktop.nix> ];
}

@oxij
Copy link
Member

oxij commented Feb 24, 2018

Probably a good idea to point to this #35292 (comment) here too.

@abbradar
Copy link
Member

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.

@oxij
Copy link
Member

oxij commented Feb 24, 2018 via email

@abbradar
Copy link
Member

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 stateVersion is unfit for this so we have no good way of determining.

Offtopic: @oxij made a good point that we should warn if stateVersion is not set. Instead we should have a special value that says "I want bleeding edge state assumptions and don't mind consequences".

@oxij
Copy link
Member

oxij commented Feb 24, 2018 via email

@abbradar
Copy link
Member

@oxij Yeah, I actually wanted to propose you to split stateVersion changes into a separate PR.

@oxij
Copy link
Member

oxij commented Sep 10, 2018

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.

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

Successfully merging this pull request may close these issues.

None yet

8 participants