From 91cdf647a46ee6464513bddb4a7bfe8725af8b6f Mon Sep 17 00:00:00 2001 From: Tyson Whitehead Date: Fri, 26 Apr 2019 17:41:51 -0400 Subject: [PATCH] opengl: Update for newer libglvndr setup --- pkgs/all-packages.nix | 2 +- pkgs/opengl/default.nix | 35 ++++++++++++++++++++--------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/pkgs/all-packages.nix b/pkgs/all-packages.nix index 252d2fb..71a3565 100644 --- a/pkgs/all-packages.nix +++ b/pkgs/all-packages.nix @@ -26,7 +26,7 @@ self: super: pkgs: with pkgs; { minia = callPackage ./minia.nix { }; - inherit (callPackage ./opengl/default.nix { inherit super; }) mesa_noglu; + inherit (callPackage ./opengl/default.nix { inherit super; }) libGL; inherit (callPackages ./octopus/octopus.nix { stdenv = overrideCC stdenv gcc5; gfortran = gfortran5; }) octopus72; octopus7 = octopus72; diff --git a/pkgs/opengl/default.nix b/pkgs/opengl/default.nix index d79ad43..8f9cbb3 100644 --- a/pkgs/opengl/default.nix +++ b/pkgs/opengl/default.nix @@ -8,18 +8,19 @@ let autoVirtualGLHook = let - mesa_noglu = super.mesa_noglu; - mesa_glu = super.mesa_glu.override { inherit mesa_noglu; }; - mesa = buildEnv { - name = "mesa-${mesa_noglu.version}"; - paths = [ mesa_noglu.dev mesa_noglu.out mesa_glu mesa_glu.dev ]; - meta = { - platforms = lib.platforms.unix; - }; - }; - libGL = mesa_noglu; - libGLU = mesa_glu; - libGLU_combined = mesa; + # Ugliness required to break the loop created by the fact that + # the libGL hook requires VirtualGL which requires libGL. + # + # This would be clean if super was closed on itself (nixpkgs #15280) + + libGL = super.libGL; + libGLU = super.libGLU.override { inherit libGL; }; + libGLU_combined = (buildEnv { + name = "libGLU-combined"; + paths = [ libGL libGLU ]; + extraOutputsToInstall = [ "dev" ]; + }); + virtualglLib = (super.virtualglLib.override { inherit libGLU_combined fltk; }); fltk = super.fltk.override { inherit libGLU_combined freeglut; }; freeglut = super.freeglut.override { inherit libGL libGLU; }; @@ -31,7 +32,11 @@ let } ./insert-virtualgl.sh; in { - mesa_noglu = super.mesa_noglu.overrideAttrs ( attrs: { - propagatedBuildInputs = attrs.propagatedBuildInputs or [] ++ [ autoVirtualGLHook ]; - } ); + libGL = super.libGL.overrideAttrs ( attrs: { + # Done as a non-standard build command, so have to add it in this way + + buildCommand = attrs.buildCommand + '' + echo '${autoVirtualGLHook}' >> $dev/nix-support/propagated-build-inputs + ''; + } ); }