X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=blobdiff_plain;f=shell.nix;h=3a91384c87e6e7f1b4b4296b626e3fc4f3ee6bc9;hp=fa19e72dcc63db877971ad7408a7dd09d3976093;hb=4aca9869ea4fae463106e1c0bb347a4dfe5d9889;hpb=618d842e05d7f65ef8ca8e56a0d0cfbffd6c08de diff --git a/shell.nix b/shell.nix index fa19e72dcc..3a91384c87 100644 --- a/shell.nix +++ b/shell.nix @@ -5,11 +5,9 @@ let runtimeLibs = with xorg; [ glib pango cairo - gtk2-x11 - gdk_pixbuf - gnome2.gtkglext pcre - mesa_glu + libGL + libGLU freealut openssl udis86 # available since NixOS 19.09 @@ -17,24 +15,39 @@ let libogg libvorbis zlib - ]; - runtimeLibPath = lib.makeLibraryPath runtimeLibs; + ] ++ (if stdenv.isDarwin then [] else [ + gtk2-x11 + gdk_pixbuf + gnome2.gtkglext + ]); + runtimeLibPath = "/run/opengl-driver/lib:" + lib.makeLibraryPath runtimeLibs; in (mkClangShell { name = "factor-shell-env"; - LD_LIBRARY_PATH = "/run/opengl-driver/lib:${runtimeLibPath}" ; + LD_LIBRARY_PATH = runtimeLibPath ; buildInputs = runtimeLibs ++ [ # for building factor git curl makeWrapper - ]; + ] ++ (if stdenv.isDarwin then [darwin.apple_sdk.frameworks.Cocoa] else []); shellHook = '' + # Set Gdk pixbuf loaders file to the one from the build dependencies here + unset GDK_PIXBUF_MODULE_FILE + # Defined in gdk-pixbuf setup hook + findGdkPixbufLoaders "${pkgs.librsvg}" + wrapFactor () { [ -n "$1" ] || { printf "Usage: wrapFactor " ; return; } local root="$(realpath $1)" local binary="''${root}/factor" + local wrapped="''${root}/.factor-wrapped" + # Remove the wrapped binary if a new VM has been compiled + ${lib.getBin file}/bin/file "$binary" |grep ELF >/dev/null && rm -f "$wrapped" + # Restore the factor binary if it was already wrapped + [ -e "$wrapped" ] && { mv "$wrapped" "$binary" ; } wrapProgram "$binary" --prefix LD_LIBRARY_PATH : ${runtimeLibPath} \ + --set GDK_PIXBUF_MODULE_FILE "$GDK_PIXBUF_MODULE_FILE" \ --argv0 factor ln -sf "''${root}/factor.image" "''${root}/.factor-wrapped.image" }