-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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/wireplumber: add extraConfig
/ extraScripts
options for WirePlumber 0.5
#292115
Conversation
@K900 I've created this PR now to try and fix the lack of an Do you know if WirePlumber All in all, this is not looking quite that trivial if |
From a bit of testing I've done and from what I can tell based on https://gitlab.freedesktop.org/pipewire/wireplumber/-/blob/0.4/src/config, the top-level, non-lua From a cursory search it also seems that nixpkgs doesn't currently (explicitly) support the multi-instance mode of wireplumber, right? I've added options for the config files relevant for that as well, just in case linking to the appropriate documentation. If you think it'd be less confusing to just not have those options, please do tell. |
A caveat with the |
extraConfig
/ extraScript
optionsextraConfig
/ extraLuaConfig
/ extraScripts
options
51e50d7 should probably go into a separate PR. I'll strip that out into a separate one when cleaning up this PR. |
dc08fb9
to
8c58a55
Compare
I've tested the current state of this PR on my NixOS setup with nixpkgs on nixos-unstable. Appending to |
8c58a55
to
efdcaba
Compare
{ | ||
matches = { | ||
{ | ||
{ "application.name", "matches", "io.github.celluloid_player.Celluloid" }, |
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.
This is a very cool example.
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.
This one came easily and I'm rather happy with it as well. I'll try and see if I can find similarly good examples for the others as well
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've added an example to the bluetooth and policy Lua config each. I gotta note that I've not tested these examples. I might try to today or in the next few days, but especially the policy config seems a bit hard to test since I know of nothing that actually uses policy defined endpoints at the moment (in the usual desktop setup of wireplumber that I have). Then again, maybe I just need to look harder.
efdcaba
to
8653d9a
Compare
8653d9a
to
8604f01
Compare
Document the breaking change caused by NixOS#282377. Assertions for better error messages for this breaking change were added in NixOS#291946. NixOS#292115 will add a better migration path for WirePlumber by adding `extraConfig` style options that previously did not exist for WirePlumber.
I've created #293248 to document the breaking change as it is now. Once that lands I'll add a commit to this PR to update the release notes again with the options added in this PR as a migration option (currently #293248 adds a note stating that |
8604f01
to
9908598
Compare
Wireplumber 0.5 is RC1 now, and moved back to old config structure: #278760 Maybe we should update this PR to use 0.5 config already? |
Probably a good idea since it can be one option less with 0.5. |
Oh and should I roll #293248 into this PR, or should I keep that separate? |
No strong preference either way. I'll take a closer look at this tomorrow. |
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.
Overall very cool, can you promise the examples still work? :)
There's now some proper migration documentation from wireplumber's side: https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/migration.html It seems from some brief experimentation that scripts in /etc/wireplumber/scripts aren't loaded any more, they have to be somewhere in $XDG_DATA_DIRS (I guess that's probably going to be /run/current-system/sw/share). |
This PR would definitely have saved me some time. I'm tempted to go further in a future PR by providing a nix-native configuration for the JSON config, like many other modules do. |
f452138
to
a8571b7
Compare
Sorry for the lack of activity last week. I've rebased to the current |
How do you think that |
Then again. It'd be nicer for users if you could just take a peek at |
f54bfd2
to
d25999f
Compare
I've changed the implementation of I've tested that configuration is picked up by WirePlumber with the LDAC quality example form {
services.pipewire.wireplumber = {
extraConfig = {
"test-script-component" = {
"wireplumber.components" = [{
name = "test-script.lua";
type = "script/lua";
provides = "custom.test-script";
}];
"wireplumber.profiles".main."custom.test-script" = "required";
};
};
extraScripts = {
"test-script" = ''
print("Hello, world!")
'';
};
};
} This successfully prints "Hello, world!" in the WirePlumber log. I still have to tweak the implementation a bit so that scripts can not only be directly in |
Upstream has a big migration guide now: https://pipewire.pages.freedesktop.org/wireplumber/daemon/configuration/migration.html |
transition kw-nixfiles -> tree remove other uses of it amd_pstate no longer a module pipewire/wireplumber config update (revisit if/when NixOS/nixpkgs#292115 hits unstable?) pinentry changes neovim config fix gaymes: rip yuzu knot-resolver: disabled so I can build amaterasu for now, nixpkgs/nixos#301747 is almost to nixos-unstable and I can update again then)
Finally got around to finishing this. This is ready for review again now, and I'll squash the commits after that for merging. Thanks for your help and patience so far :) |
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.
SGTM. Squash?
Follow-up to NixOS#282377. NixOS#282377 broke `environment.etc."wireplumber<...>"`, however WirePlumber did not yet have `extraConfig` style options for configuring it ergonomically outside of `environment.etc`. This has caused issues for people who had custom config files for WirePlumber, as having to create a config package just to edit some settings is not as ergonomic or discoverable as with a proper `extraConfig` style option. This commit fixes this issue by adding the `extraConfig` option for additional config file and the `extraScripts` option for additional scripts to be used by config files. With WirePlumber 0.5 it is possible to supply config files and scripts via the `XDG_DATA_DIRS` variable to the WirePlumber daemon. This is how the new options and with this change also the `configPackages` option expose their files to the daemon. This way `environment.etc."wireplumber"` works again for user configuration and breakage of old configs from 23.11 to 24.05 should be limited to those caused by the change in the config format from WirePlumber 0.4 to 0.5.
d2341a6
to
72ed337
Compare
I've squashed the commits. If you have any more suggestions for what to test before getting this merged, feel free to tell me and I'll try my best to give those a try. |
Description of changes
Follow up to #282377 and #291946. #282377 broke the use of
environment.etc."wireplumber<...>"
and did not yet add anextraConfig
option to make up for that, so currently WirePlumber can only be configured viaservices.pipewire.wireplumber.configPackages
. This is hardly ergonmomic, so this PR addsextraConfig
/extraScripts
options to fix that.Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.