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

Module pipewireLowLatency causes build failure #161

Open
LovingMelody opened this issue Feb 26, 2024 · 30 comments
Open

Module pipewireLowLatency causes build failure #161

LovingMelody opened this issue Feb 26, 2024 · 30 comments

Comments

@LovingMelody
Copy link
Contributor

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
@NotAShelf
Copy link
Contributor

The directory should be generated if not available, as per how environment.etc works. Do you use pipewire locally?

@e-nikolov
Copy link

e-nikolov commented Feb 27, 2024

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.

@NotAShelf
Copy link
Contributor

Could you see if pointing your input at #162 resolves the issue?

@e-nikolov
Copy link

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.

@e-nikolov
Copy link

e-nikolov commented Feb 27, 2024

In case it's useful, I think these are the recent commits to nixpkgs that contain pipewire related changes:

Coming from those PRs:

@NotAShelf
Copy link
Contributor

do you override nix-gaming's instance of nixpkgs?

@e-nikolov
Copy link

do you override nix-gaming's instance of nixpkgs?

Yes, I do

@NotAShelf
Copy link
Contributor

NixOS/nixpkgs@8ba76f8 added extraConfig, not sure why it wouldn't be available. I'll take another look

@NotAShelf
Copy link
Contributor

oversight on my behalf, try now please

@e-nikolov
Copy link

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

@NotAShelf
Copy link
Contributor

NotAShelf commented Feb 27, 2024

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.

@NotAShelf
Copy link
Contributor

This is going to be a weird question, but do you have wireplumber enabled?

@e-nikolov
Copy link

e-nikolov commented Feb 27, 2024

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.

@NotAShelf
Copy link
Contributor

@e-nikolov
Copy link

e-nikolov commented Feb 27, 2024

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.

@e-nikolov
Copy link

e-nikolov commented Feb 27, 2024

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?

@LovingMelody
Copy link
Contributor Author

LovingMelody commented Feb 27, 2024

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

@NotAShelf
Copy link
Contributor

I follow nixpkgs-small for my nix-gaming input. Might be why I did not came across that warning.

@NotAShelf
Copy link
Contributor

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.

@LovingMelody
Copy link
Contributor Author

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.

@NotAShelf
Copy link
Contributor

Updated nixpkgs @ #162. Should be good for a merge, but testing would be appreciated.

@matt1432
Copy link

Updated nixpkgs @ #162. Should be good for a merge, but testing would be appreciated.

Just tried it and I still have the build failure.

@NotAShelf
Copy link
Contributor

Are you overriding your nixpkgs input locally?

@NotAShelf
Copy link
Contributor

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.

@NotAShelf
Copy link
Contributor

As per NixOS/nixpkgs#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.

@matt1432
Copy link

It looks like your PR fixes it now, at least on my machine @NotAShelf

@e-nikolov
Copy link

Same here

@hcsch
Copy link

hcsch commented Feb 28, 2024

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 NixOS/nixpkgs#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

@NotAShelf
Copy link
Contributor

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.

@hcsch
Copy link

hcsch commented Feb 29, 2024

NixOS/nixpkgs#292115 will add extraConfig, extraLuaConfig, and extraScripts options once it lands. I hope that'll make things more comfortable again for you

TLATER added a commit to TLATER/dotfiles that referenced this issue Mar 4, 2024
TLATER added a commit to TLATER/dotfiles that referenced this issue Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants