nix-gaming
nix-gaming copied to clipboard
Module pipewireLowLatency causes build failure
Attempting to build on nixos-unstable with the services.pipewire.lowLatency.enable = true
causes the build to failed due to the usage of environment.etc."pipewire/pipewire-pulse.d"
Error message:
mkdir: cannot create directory '/nix/store/mhzd8fy047lqcp72lmakmi7rlaap31zf-etc/etc/pipewire/pipewire-pulse.d': Permission denied
The directory should be generated if not available, as per how environment.etc
works. Do you use pipewire locally?
I haven't tried it on my actual machine yet but I get the same error in the CI pipeline that updates my flake.lock - https://github.com/e-nikolov/nix-config/actions/runs/8061032114/job/22018053387?pr=421
Flake lock file updates:
• Updated input 'code-insiders':
'github:e-nikolov/code-insiders-flake/d190c0f749d5b359f4166b251d18a7099ae698b8' (2024-02-25)
→ 'github:e-nikolov/code-insiders-flake/350229dfe0d6c15ef228ba14371a867e4770afc5' (2024-02-27)
• Updated input 'helix':
'github:helix-editor/helix/cd02976fa3a55c2c1f01b95c40d178061968f797' (2024-02-26)
→ 'github:helix-editor/helix/f46a09ab4f945273c7baf32e58438b501914fabb' (2024-02-27)
• Updated input 'nixpkgs':
'github:nixos/nixpkgs/2a34566b67bef34c551f204063faeecc444ae9da' (2024-02-25)
→ 'github:nixos/nixpkgs/548a86b335d7ecd8b57ec617781f5e652ab0c38e' (2024-02-26)
The only relevant change seems to be the update to nixpkgs. So probably the latest batch of commits to nixpkgs-unstable broke this.
Could you see if pointing your input at #162 resolves the issue?
I get another error now - https://github.com/e-nikolov/nix-config/actions/runs/8063764183/job/22026253959?pr=421
error:
… while calling the 'seq' builtin
at /nix/store/km3kyvmrh30vsl7wqb1njqv3fylcfq9g-source/lib/modules.nix:322:18:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
… while calling the 'throw' builtin
at /nix/store/km3kyvmrh30vsl7wqb1njqv3fylcfq9g-source/lib/modules.nix:[29](https://github.com/e-nikolov/nix-config/actions/runs/8063764183/job/22026253959?pr=421#step:6:30)8:18:
297| ''
298| else throw baseMsg
| ^
299| else null;
error: The option `services.pipewire.extraConfig."99-lowlatency.conf"' does not exist. Definition values:
- In `/nix/store/qdbzbfi8ns5n1vcw[42](https://github.com/e-nikolov/nix-config/actions/runs/8063764183/job/22026253959?pr=421#step:6:43)hwd8q9h6xh6cn6-source/flake.nix#nixosModules.pipewireLowLatency':
{
_type = "if";
condition = true;
content = <derivation 99-lowlatency.conf>;
}
Error: Process completed with exit code 1.
In case it's useful, I think these are the recent commits to nixpkgs that contain pipewire related changes:
-
https://github.com/NixOS/nixpkgs/commit/d596c9b4b56eab141b9bbfe5a4e84349549752de
-
https://github.com/NixOS/nixpkgs/commit/eb74747f38d83f83aa6aace76e3f76a76194b081
-
https://github.com/NixOS/nixpkgs/commit/92b9d11129f9134f4592d3c75cb6764c1c2cfece
Coming from those PRs:
-
https://github.com/NixOS/nixpkgs/pull/282377
-
https://github.com/NixOS/nixpkgs/pull/291513
do you override nix-gaming's instance of nixpkgs?
do you override nix-gaming's instance of nixpkgs?
Yes, I do
https://github.com/NixOS/nixpkgs/commit/8ba76f8dd46043c2928f39da7491da8b3b335f24 added extraConfig, not sure why it wouldn't be available. I'll take another look
oversight on my behalf, try now please
Now I get
error: builder for '/nix/store/0l6zqvp6r82s2r8k7z4lxi9affjiz4dd-etc.drv' failed with exit code 1;
last 1 log lines:
> mkdir: cannot create directory '/nix/store/s53jbbchpcvnprqb8clq8vnr2h3s30fq-etc/etc/wireplumber/main.lua.d': Permission denied
I'd really like to know why your /etc/wireplumber
is not writable through etc.environment
Using the exact same module, /etc/wireplumber/main.lua.d/99-alsa-lowlatency.lua
is generated correctly for me.
This is going to be a weird question, but do you have wireplumber enabled?
I don't have anything about wireplumber in my nix-configs.
https://github.com/e-nikolov/nix-config/blob/43d06c243df9928fcfe686697580e316b245e7d5/preferences/nixos/audio.nix#L24-L41
I also haven't seen it mentioned in the docs for nix-gaming. Do I have to enable it? Things seemed to work fine until today.
https://search.nixos.org/options?channel=23.11&show=services.pipewire.wireplumber.enable&from=0&size=50&sort=relevance&type=packages&query=wireplumber
should be enabled by defaulting according to the option docs
https://github.com/NixOS/nixpkgs/blob/7d3c9aeca783e2af811a6dd5e97e88ce55babd9c/nixos/modules/services/desktops/pipewire/wireplumber.nix#L105
environment.etc.wireplumber.source = "${configs}/share/wireplumber";
I think one of the recent changes in nixpkgs-unstable creates the "/etc/wireplumber" directory and it somehow prevents the environment.etc
option you added from creating the low-latency config.
Using the exact same module, /etc/wireplumber/main.lua.d/99-alsa-lowlatency.lua is generated correctly for me.
Do you by any chance have something like this in your flake:
inputs.nix-gaming.follows = "nixpkgs";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
I think commit that causes the issue is only on nixpkgs-unstable and not on nixos-unstable yet.
They also have:
pathsToLink = [ "/share/wireplumber" ];
and a new configPackages option.
Perhaps the correct way to add the low latency config is via a package that outputs to /share/wireplumber/99-alsa-lowlatency.lua
and then adding it to configPackages?
I am currently using nixos-unstable-small
, though talking in the matrix chat they did indicate that this is an expected issue
Progress tracker for the PRs: https://nixpk.gs/pr-tracker.html?pr=291513 https://nixpk.gs/pr-tracker.html?pr=282377
I follow nixpkgs-small for my nix-gaming input. Might be why I did not came across that warning.
Perhaps the correct way to add the low latency config is via a package that outputs to /share/wireplumber/99-alsa-lowlatency.lua and then adding it to configPackages?
No, we should not need to ship a package to be able to provide rules.
Looks like these changes have landed in nixpkgs-unstable
. Providing a package would not be a clean solution, would also mean overrides just for changing settings.
Updated nixpkgs @ https://github.com/fufexan/nix-gaming/pull/162. Should be good for a merge, but testing would be appreciated.
Updated nixpkgs @ #162. Should be good for a merge, but testing would be appreciated.
Just tried it and I still have the build failure.
Are you overriding your nixpkgs input locally?
https://github.com/NixOS/nixpkgs/blob/master/nixos/modules/services/desktops/pipewire/wireplumber.nix#L101C1-L113C9
Okay what the hell, they are forcing us to provide configs as a package.
As per https://github.com/NixOS/nixpkgs/pull/291946, we are no longer able to write to /etc/wireplumber
and due to the lack of an extraConfig option, we are forced to ship a config package.
I've found that using writeTextDir is able to conform to the new format, and hopefully fixed it until another maintainer high on shroom decides they don't like how things, yknow, work.
Once again, testing is appreciated.
It looks like your PR fixes it now, at least on my machine @NotAShelf
Same here
Sorry for causing this breakage! By no means did I intend to make wireplumber harder to configure and an extraConfig
option missing from my PR was a really unfortunate oversight on my part. I'm trying to get that fixed with https://github.com/NixOS/nixpkgs/pull/292115. I did try to think about how to not break environment.etc."wireplumber<...>"
, but couldn't figure anything out for that.
A good extraConfig
is also looking not quite as trivial as I'd hoped (with WirePlumber 0.4) if the .conf
files should also be changeable and not just the <...>.lua.d/*.lua
files.
From what I can tell an extraConfig
option that allows adding of lua
files to the lua.d
dirs would be sufficient for your pipewireLowLatency
module though, right?
Note: I added that assertion to at least get users with this breakage a slightly better error message. I maybe should have added a note on an extraConfig
option coming in the near future. Though ideally that should have just been part of the original PR
From what I understand, WirePlumber itself has gotten a breaking change and is moving the config files to /etc/pipewire
. Which means we probably have to go back?
From what I can tell an extraConfig option that allows adding of lua files to the lua.d dirs would be sufficient for your pipewireLowLatency module though, right?
That is correct.
NixOS/nixpkgs#292115 will add extraConfig
, extraLuaConfig
, and extraScripts
options once it lands. I hope that'll make things more comfortable again for you