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
pipewire: 0.3.18 -> 0.3.21 #110615
pipewire: 0.3.18 -> 0.3.21 #110615
Conversation
024572a
to
1c9e9c8
Compare
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 think it's still missing the *-monitor
files, though overriding specific array values are a problem, though it can be mitigated by overrides if it is based on the order of the elements in the array.
Not quite sure about if the attribute sets are valid for the configuration, I only used a literal translation "bluez5.msbc-support"
.
}; | ||
flags = "ifexists|nofail"; | ||
}; | ||
libpipewire-module-protocol-native = null; |
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 needs to be ordered in order for pipewire to work on my machine (thus the sortProperties in the generation), though I'm not too sure about how nice it looks with libpipewire-module-protocol-native = { _priority = -100; _content = "null"; };
being what I have locally.
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.
Is this addressed now? Do we care?
"{${lib.concatStringsSep " " (mkSPAKeyValue { _SPA_DUP = v._type or "" == "_SPA_DUP"; } v)}}" | ||
else lib.generators.mkValueStringDefault {} v; | ||
|
||
mkSPAKeyValue = { _SPA_DUP ? false }: attrs: map (def: def.content) (lib.sortProperties |
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 couldn't get this working in any sort of elegant fashion, though the only part affected by this is the objects
field for pipewire.conf
.
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 simplified version that just gets rid of the _SPA_DUP
mkSPAValueString = v:
if builtins.isList v then "[${lib.concatMapStringsSep " " mkSPAValueString v}]"
else if lib.types.attrs.check v then
"{${lib.concatStringsSep " " (mkSPAKeyValue v)}}"
else lib.generators.mkValueStringDefault { } v;
mkSPAKeyValue = attrs: map (def: def.content) (
lib.sortProperties
(
lib.mapAttrsToList
(k: v: lib.mkOrder (v._priority or 1000) "${lib.escape [ "=" ] k} = ${mkSPAValueString (v._content or v)}")
attrs
)
);
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.
Hmm how is that meant to be used? With the current toSPAJSON = attrs: lib.concatStringsSep "\n" (mkSPAKeyValue {} attrs);
these just cause a "attempt to call something which is not a function but a list.
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.
How about this?
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.
If we're making converting the JSON to Nix sets before reconverting that to SPA JSON then more or less you'll still need parts of this. sortProperties
will definitely be needed because of the load-module
ordering dependency.
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.
Also get's messy if there are multiple objects
with the same factory since duplicate keys aren't allowed in Nix sets.
Now it builds and the config file looks There are also a couple of config files for the media session that need to be generated... |
I'm pretty sure that's because of protocol-native needs to be loaded first. My local config in a gist, https://gist.github.com/eadwu/321fb3b45e0790424ba88488f7407b85. |
Ah, that's what you meant by that. Let's see how adapting that gist of yours works out. |
any progress on this? |
Been busy with work and other stuff, planning to get back to this PR in the evening. |
This is more of a suggestion for future PRs, but I found #111076 interesting. For Mattermost (completely unrelated to pipewire), the corresponding NixOS module parses the default JSON config file provided by the package, instead of duplicating most of the data in it. A similar idea could be used in pipewire, even though SPA JSON is not quite JSON. A possible downside of doing this is explained in the linked issue. |
Using IFD in the module system will not sit right with Hydra, which makes that method a no-go for module that is enabled by default in desktop tests. |
@jtojnar Would it still be a problem if the default config files were manually copied to |
That should work. We do something similar in fwupd (copy the data to nixpkgs/pkgs/os-specific/linux/firmware/fwupd/default.nix Lines 275 to 330 in aa48e20
|
One problem though: the default config is generated with absolute paths to the pipewire and pipewire-media-session binaries at build time... |
Yay, it's making noises again. Even with over bluetooth (which is a first for me with pipewire)! Someone who actually knows what they are doing should really look it over though, there is now way this is passing tests as is. Also I didn't really get how the passthru stuff is supposed to work. |
description = '' | ||
Path to the pipewire session manager executable. | ||
''; | ||
}; | ||
|
||
sessionManagerArguments = 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.
where did sessionManagerArguments go? is there a new way to pass arguments to the session manager invocation?
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 was thinking of adding an extraEtcFiles instead since that's the way to configure pipewire-media-session now. But for other session managers it makes sense to keep this around I guess.
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.
maybe settings
as per NixOS/rfcs#42?
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 problem is that depending on the session manager there can be an arbitrary number of config files and their names (nor syntax) aren't known ahead of time. The current solution allows specifying arbitrary files and if the toSPAJSON
function is made public (just looking for the right place for it) it would allow specifying settings for pipewire-media-session
mostly in this way, just like is done with pipewire.conf (except for having to manually call the fn). But a fancy config generation setup can be done separately too.
Don't know yet why but |
Next release will have another wave of configuration files if master stays the same. Format will be the same, but there will be a lot more files. |
Mhm. Is there a better way to provide those without having to provide all their content in our module? This becomes a maintenance nightmare otherwise. Is the parser flexible enough to just merge trees? So if there is a default configuration that gets redefined by a later, it would just take the later value? Than we could concatenate default + overrides. |
cc @wtay @pv, we want to make pipewire configurable in NixOS through NixOS options. Basically we convert our own nix data structures to pipewire configuration format (see https://github.com/NixOS/nixpkgs/pull/110615/files#diff-6c167307e84d42c088d640f1859ad87e6c8cb15c1ce2353361eac78b5351027eR58). Do you see a way within the format that would allow us to use upstream defaults while still allowing all configuration items to be imported without importing all upstream defaults in our module? |
As I understand it, a valid JSON file should work as a configuration file, but the SPA JSON parser accepts more than just well-formed JSON on purpose (to make the configuration file less cluttered?). So outputting a config file should be doable with standard tools, but we would need to port https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/spa/include/spa/utils/json.h to Nix (or have an update script that preprocesses stuff) be able to parse the sample config files. |
Yes. Ideally something that does it at runtime. |
There you go: https://github.com/nix-community/pipewire-to-json |
There is now also a canonical converter in PipeWire: https://gitlab.freedesktop.org/pipewire/pipewire/-/commit/3c9996aa781c3cf3623547dbddad4772196ae391 |
Would it be worth getting this merged as-is and waiting until 0.3.22 to clean up the configuration file handling (so the new |
I am fine either way, before we can merge this the evaluation error needs to be fixed so. Do you think it would change the module interface a lot? |
moveToOutput "bin/pipewire-media-session" "$mediaSession" | ||
''; | ||
|
||
passthru = { |
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.
passthru = { | |
passthru.tests = { |
fixes the installed-tests
evaluation error for me.
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.
Thanks for spotting this! Must have slipped through while I tested stuff that involved changing this section.
Personally I'd like to see this merged as soon as possible - for me it's meaning I can't fully switch to pipewire because it breaks some apps which ignore the default output defined. It looks like the fix for this is in this newer version. :) |
my pipewire refuses to start,
|
|
I'm not sure what it supposed to look like, that's what I've got:
edit: using triplebackquotes for pipewire.conf so linebreaks are not lost and that's how I configured it: { config, pkgs, ... }: {
security.rtkit.enable = true;
nixpkgs.config.pulseaudio = true;
hardware.pulseaudio.enable = pkgs.lib.mkForce false;
services.pipewire = {
enable = true;
package = pkgs.master.pipewire;
alsa.enable = true;
pulse.enable = true;
jack.enable = true;
};
} |
@Kazimazi pipewire's config got a massive change, you are using the module from stable (which expects 0.3.18), but pipewire 0.3.20 can't read the old config format. |
Just to be sure: Does your config file really not contain a line break before "module"? If that was a GitHub formatting error, please use triple backquotes :) Edit: Oh, sorry, I didn't see the other comment. Yeah, it looks like you're using Pipewire 0.3.18 with the 0.3.21 config file, since your config file looks fine for 0.3.21 (except for the lack of line breaks). |
It might be something trivial, but I can't wrap my head around it. How do I use the new module? |
What is "pkgs.master" on your config? I don't have this attribute on my local config (according to |
It's an overlay of master branch of nixpkgs, which is updated. |
I think I've got my issue resolved... there was a symlink to a non-existent /nix/store/...pipewire3.18 in ~/.config/systemd/user and it was conflicting with the new one. Don't know when or why it got there so I deleted it. |
I ran into the same issue with #115492 .
|
Motivation for this change
https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/0.3.21
https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/0.3.20
https://gitlab.freedesktop.org/pipewire/pipewire/-/releases/0.3.19
Things done
Initial attempt at generating config file in the new format using the upstream template as a base. Pulseaudio and jack (patchbays) seem to be working, everything else needs testing.
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)