-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
mpd: nixos module support for standard users #62771
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
Conversation
Please have a look at #57608. |
This pull request has been mentioned on Nix community. There might be relevant details there: |
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 have only reviewed the module changes, but yeah this seems like the right direction to me. 👍
@@ -136,67 +144,73 @@ in { | |||
parameter is omitted from the configuration. | |||
''; | |||
}; | |||
|
|||
addBinariesToGlobalEnvironment = mkOption { |
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.
Personally I'm not a fan of options that simply add binaries to the global environment mostly because it is very simple to have the user do so themselves. I'm not sure if my opinion on this is popular or not. 🤷♂️
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 also don't think we need to have this option.
}; | ||
}; | ||
|
||
users.users = optionalAttrs (cfg.user == name) (singleton { | ||
users.users = lib.mkIf cfg.startSystemWide (optionalAttrs (cfg.user == name) (singleton { |
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.
users.users = lib.mkIf cfg.startSystemWide (optionalAttrs (cfg.user == name)
-> users.users = optionalAttrs (cfg.user == name && cfg.startSystemWide)
inherit description listenStreams wantedBy; | ||
}; | ||
|
||
systemd.user.sockets.mpd = mkIf (!cfg.startSystemWide) { |
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.
It might help to comment on what's going on with these sockets as it isn't immediately obvious how this works in conjunction with your addition to systemd.packages
.
@@ -54,6 +54,14 @@ in { | |||
''; | |||
}; | |||
|
|||
startSystemWide = mkOption { |
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.
After some discussion involving tmpfiles
and the appropriateness of specifying normal users for NixOS modules (which I'm almost certain you were a part of, sorry if I'm mistaken...) I think this option might become at least a little bit of a pattern going forward. That being said it is always good to have consistent naming conventions. startSystemWide
is a very clear name so we should all agree to push this name as a loose 'standard' going forward, yeah?
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.
the appropriateness of specifying normal users for NixOS modules
That's not really what this is. This is about making it available in a declarative way to normal users but not forcing it to run.
should all agree
I'm not sure that all those that should agree are seeing this... ;-)
Sorry about the noise guys, but I really need to find some time to clean this up. Everybody cool with leaving it open? |
@peterhoeg of course that is fine! Let me know if you can't find the time and you need a hand 😄 |
Closing this for 2 reasons:
|
Motivation for this change
Lots of new upstream activity.
Upstream is now using meson instead of autotools, so that's what we will use too.
There was a lot of redundant logic in order to deal with optional features (managing both flags and build inputs), so we now just add everything to buildinputs but use the flags to determine what is built in. If a dependency is not used, we don't have a reference to it either.
The nixos module now allows running mpd in a normal systemd user session (default is still system-wide) and we use the unit files from upstream instead of duplicating them.
Running fine here.
Cc: @astsmtl @Fuuzetsu @ehmry @fpletz
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)