From aebd364a771946e1a088cebff24a16a063bbfc3b Mon Sep 17 00:00:00 2001 From: Paul Garlick Date: Thu, 26 Oct 2017 13:44:14 +0100 Subject: update Nix shell function for 3D graphics applications --- INSTALL.md | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/INSTALL.md b/INSTALL.md index d268dc1..f0c3f25 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -98,24 +98,17 @@ install the *TWEED* packages, use the following command: $ nix-env -f tweed.nix -i -Nix applications that use 3D graphics acceleration need help in finding the -system libraries and drivers. The paths vary according to operating system and -graphics card. For a CentOS 6 system, for example, with an Intel graphics card -six extra paths need to be defined. This can be accomplished with an alias or -a shell function. Using the shell function approach for the CentOS example, -the following lines added to the .bashrc file provide a function that sets the -necessary environment variables and runs the FreeCAD application: +It is necessary to set an extra environment variable for Nix applications that +use 3D graphics acceleration. The extra variable defines the path to the +directory in the Nix store that contains the graphics drivers. This can +conveniently be accomplished with an alias or a shell function. Using the +shell function approach, for the FreeCAD application, the following lines added +to the ~/.bashrc file provide a function that sets the necessary environment +variable and runs the application: freecad () { - FONTCONFIG_PATH="$HOME/.nix-profile/etc/fonts/fonts.conf" \ - LIBGL_DRIVERS_PATH="/usr/lib64/dri" \ - LIB1="/lib64/libselinux.so.1" \ - LIB2="$HOME/.nix-profile/lib/libdrm.so" \ - LIB3="$HOME/.nix-profile/lib/libdrm_intel.so" \ - LIB4="$HOME/.nix-profile/lib/libdrm_radeon.so" \ - LIB5="$HOME/.nix-profile/lib/libpciaccess.so.0" \ - LD_PRELOAD=$LIB1:$LIB2:$LIB3:$LIB4:$LIB5 \ - FreeCAD + LIBGL_DRIVERS_PATH=$(nix-build --no-out-link -A mesa_drivers $HOME/.nix-defexpr/channels/nixpkgs)/lib/dri \ + $HOME/.nix-profile/bin/FreeCAD } -- cgit