NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.39k stars 13.61k forks source link

plots: GLSL 3.30 is not supported #336981

Open MichaelBrunn3r opened 3 weeks ago

MichaelBrunn3r commented 3 weeks ago

Describe the bug

plots crashes upon startup with the error (it's massive, here is the relevant bit):

> plots
OpenGL ES version: 3.2
Traceback (most recent call last):
  File "/nix/store/zjl19r0hwarxcz7ijw4i5i3nand7a8d4-plots-0.8.5/lib/python3.11/site-packages/plots/plots.py", line 227, in update_shader
    attempt(good + bad + unknown)
  File "/nix/store/zjl19r0hwarxcz7ijw4i5i3nand7a8d4-plots-0.8.5/lib/python3.11/site-packages/plots/plots.py", line 222, in attempt
    self.gl_area.update_fragment_shader(formulae)
  File "/nix/store/zjl19r0hwarxcz7ijw4i5i3nand7a8d4-plots-0.8.5/lib/python3.11/site-packages/plots/graph.py", line 293, in update_fragment_shader
    self.shader = shaders.compileProgram(self.vertex_shader, fragment_shader)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/grp6vpyzra48garak7hwzzhm5bh3qif3-python3.11-pyopengl-3.1.7/lib/python3.11/site-packages/OpenGL/GL/shaders.py", line 211, in compileProgram
    program.check_validate()
  File "/nix/store/grp6vpyzra48garak7hwzzhm5bh3qif3-python3.11-pyopengl-3.1.7/lib/python3.11/site-packages/OpenGL/GL/shaders.py", line 109, in check_validate
    raise ShaderValidationError(
OpenGL.GL.shaders.ShaderValidationError: Validation failure (0):
...

Steps To Reproduce

Expected behavior

Launch the plots App.

Additional context

The project repo of plots already has a workardound (https://github.com/alexhuntley/Plots/issues/151):

> GDK_DEBUG=gl-prefer-gl plots

Notify maintainers

@sund3RRR

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.10.5, NixOS, 24.05 (Uakari), 24.05.20240819.f1bad50`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.5`
 - nixpkgs: `/nix/store/1lwg74im5q4fmdk3zf5az570kixzk3vb-source`

Add a :+1: reaction to issues you find important.

sund3RRR commented 3 weeks ago

idk what can I do with this issue. This is a dependency error with OpenGL.

MichaelBrunn3r commented 2 weeks ago

I thought as a hotfix there might be a possibility to wrap the binary with an environment that has that environment variable set. I'm not an expert on derivations, don't know if that's possible. Otherwise, this should be fixed in the next release of plots as the developers are already aware of it

MichaelBrunn3r commented 2 weeks ago

Nice, I got an overlay working that just wraps the program and sets GDK_DEBUG=gl-prefer-gl

{
  pkgs,
  ...
}: {
  config = {
    environment.systemPackages = with pkgs; [
      plots
    ];

    nixpkgs = {
      overlays = [
        (self: super: {
          plots = super.plots.overrideAttrs (old: {
            buildInputs = old.buildInputs ++ [pkgs.makeWrapper];
            postInstall =
              old.postInstall
              or ""
              + ''
                wrapProgram "$out/bin/plots" --set GDK_DEBUG gl-prefer-gl
              '';
          });
        })
      ];
    };
  };
}

Now running plots from the CLI or Gnome Shortcut works without issue 👍️