nixGL icon indicating copy to clipboard operation
nixGL copied to clipboard

fix: set `GBM_BACKENDS_PATH`

Open bb010g opened this issue 11 months ago • 4 comments

This is necessary to fix nixGLIntel for at least cage on SteamOS with nixos-unstable using the overlay.

bb010g avatar Jan 06 '25 10:01 bb010g

Test failure looks spurious.

bb010g avatar Jan 06 '25 21:01 bb010g

Works for me, also fixes hyprland

hweissi avatar Jan 14 '25 14:01 hweissi

This works for me when I override the nixGL nixpkgs with a more recent version

nixgl = {
  url = "github:johanneshorner/nixGL";
  inputs.nixpkgs.follows = "nixpkgs";
};

otherwise building fails with

ls: cannot access '/nix/store/2l4j4zp09047g61c0hw5ndw8k7lakd0c-mesa-22.1.4-drivers/lib/gbm': No such file or directory
File /nix/store/2l4j4zp09047g61c0hw5ndw8k7lakd0c-mesa-22.1.4-drivers/lib/gbm, referenced in /nix/store/kkbmn75rp8w01vcp92fpmnp0mn7zjjhq-nixGLIntel/bin/nixGLIntel does not exists.

Seems that the offending gbm files were introduced in a recent version of mesa. https://github.com/NixOS/nixpkgs/issues/368379

johanneshorner avatar Jan 27 '25 10:01 johanneshorner

Not super educated on this, but does this fail to include a dependency? image EDIT: I did not fully read the previous comment, oops -_-

Notarin avatar Feb 12 '25 13:02 Notarin

Is there a path forward to merge this? It solved my problems trying to run hyprland on a non-NixOS Ubuntu host?

noar-t avatar May 15 '25 05:05 noar-t

Thanks for the patch, fixed the issue on my machine. Similar to noar-t at Ubuntu 24.04.2 LTS with Intel Arc graphics.

Shuna322 avatar May 20 '25 12:05 Shuna322

Thank you for this patch. It fixed my issue with Chromium-based bwosers crashing on non-NixOS/generic linux installs in https://github.com/NixOS/nixpkgs/issues/413500

Update: It fixed the GPU support in Chromium and alike, but not the referenced issue itself.

skf-funzt avatar Jun 06 '25 07:06 skf-funzt

this seems to also be needed for niri to work on non-NixOS. one of my users reports that this fixes their issue. https://github.com/YaLTeR/niri/issues/1780#issuecomment-2969226907

is there any reason it hasn't been merged? seems like a very simple change that fixes an issue affecting, as far as I can tell, probably all compositors? (cage, hyprland, niri)

sodiboo avatar Jun 13 '25 06:06 sodiboo

is there any reason it hasn't been merged?

+1, can we have someone elaborate on exactly what the blocker is here? If none, can we have this merged?

Notarin avatar Jun 21 '25 08:06 Notarin

It looks like nixGL may currently not have any maintainers - the last commit to it was made in April 2024. The previous maintainer transferred ownership to nix-community due to no longer having motivation to work on it. There is also a licensing issue, see #143 #174 https://github.com/orgs/nix-community/discussions/882 for more information about this.

I think if someone wanted to get this library working again, they could take up the task of getting the license fixed. Contacting all the prior contributors might also help find people who are interested in helping maintain it.

I just started a discussion over on the main nix-community discussion page about getting a maintainer for this package. https://github.com/orgs/nix-community/discussions/1884

dyfrgi avatar Jul 04 '25 17:07 dyfrgi

Tested manually on Debian 12 with Intel and it's working as-is there. @zimbatm can you please merge this one?

dyfrgi avatar Jul 08 '25 16:07 dyfrgi

can somebody take a look at failing CI on master?

zimbatm avatar Jul 09 '25 09:07 zimbatm

can somebody take a look at failing CI on master?

This snippet references a file nvidia_icd.x86_64.json which doesn't actually exist:

https://github.com/nix-community/nixGL/blob/a8e1ce7d49a149ed70df676785b07f63288f53c5/nixGL.nix#L132-L138

There's no .x86_64.json variant of that file.

dr-xr-xr-x   - /nix/store/2g3qs3ww7vj5zprl7a8908jik9rq95b4-nvidia-x11-440.82-nixGL/share/vulkan/icd.d
.r--r--r-- 212 └── nvidia_icd.json

It also references an nvidia_icd.i686.json, but i'm not sure how it looks in the i686 equivalent of the package; if i try to evaluate it, i get a null version so it's not referencing any specific version of the drivers.

There's also a comment acknowledging it probably doesn't work on i686:

https://github.com/nix-community/nixGL/blob/a8e1ce7d49a149ed70df676785b07f63288f53c5/nixGL.nix#L115

Perhaps a better way to get around this issue would be to change the offending code to glob all files in ${nvidiaLibsOnly}/share/vulkan/icd.d/ to include them in that path? i'm not sure how "correct" that is as i barely understand what half of these environment variables do, and i have no NVIDIA card to test any functionality with, but it seems reasonable to me at a glance.

sodiboo avatar Jul 09 '25 12:07 sodiboo

This PR seems to break my home-manager settings on Debian 12 with the following output:

error: builder for '/nix/store/fx4yl9rxp0swnzpygm16c4ijix3vdnag-nixGLIntel.drv' failed with exit code 255;
       last 2 log lines:
       > ls: cannot access '/nix/store/1iylw6kf8dai0m2b6iwz4jqgi5mvrn32-mesa-24.2.8-drivers/lib/gbm': No such file or directory
       > File /nix/store/1iylw6kf8dai0m2b6iwz4jqgi5mvrn32-mesa-24.2.8-drivers/lib/gbm, referenced in /nix/store/9ll4932ghd64c34d41c9hjj3bvr5f4rc-nixGLIntel/bin/nixGLIntel does not exists.
       For full logs, run 'nix log /nix/store/fx4yl9rxp0swnzpygm16c4ijix3vdnag-nixGLIntel.drv'.
error: 1 dependencies of derivation '/nix/store/1cqlvmgdkqd4mhijrwjpqhx05jjsgbcg-nixGLCombinedWrapper-Intel.drv' failed to build
error: 1 dependencies of derivation '/nix/store/mpyc3m03c4riixjk3769aib6svm3shgs-nixGLMesa.drv' failed to build
error: 1 dependencies of derivation '/nix/store/8dggmx5kbmp7laqzcyw9vhpy3zgjvn1g-home-manager-path.drv' failed to build
error: 1 dependencies of derivation '/nix/store/ghf3jrq18skcfj7n5qa03kjpnr93cygs-home-manager-generation.drv' failed to build

Reverting to previous commit fixes it.

ramblehead avatar Sep 05 '25 17:09 ramblehead

@ramblehead Could you provide a minimal working example flake that reproduces that error? It might be necessary to conditionally attempt construction of the lib/gbm search path. (My current guess is that your Nixpkgs version is older, or that you've specifically got a weirder setup that results in mesa-drivers in particular being older. /nix/store/1iylw6kf8dai0m2b6iwz4jqgi5mvrn32-mesa-24.2.8-drivers matches one of the outputs of build 298401442 of job nixos:release-24.11:nixpkgs.mesa.x86_64-linux on Hydra, the latest build for that job.)

If you are on nixos-24.11, would upgrading to nixos-25.05 be a feasible solution?

bb010g avatar Sep 06 '25 08:09 bb010g

@bb010g this error occurred when updating nixos-24.11 branch. I tried switching to unstable just for nixgl package and it did not work.

This is my nixgl-related config: https://github.com/ramblehead/nix-config/blob/main/flake.nix#L221 https://github.com/ramblehead/nix-config/blob/main/hm/hosts/qt-dl1.nix#L10

I just updated my NixOS PCs to nixos-25.05 yesterday. I will try updating Debian 12 box to nixos-25.05 on Monday and report back on the results.

ramblehead avatar Sep 06 '25 23:09 ramblehead

Switching to nixos-25.05 and back to nixGL/main resolves the issue.

Perhaps, it worth mentioning somewhere in README.md that main branch is not backward-compatible with nixos-24.11 and pointing to the latest working commit?

ramblehead avatar Sep 08 '25 08:09 ramblehead