1 { pkgs ? import <nixpkgs> {} }:
4 mkClangShell = mkShell.override { stdenv = clangStdenv; };
5 runtimeLibs = with xorg; [
16 udis86 # available since NixOS 19.09
22 runtimeLibPath = "/run/opengl-driver/lib:" + lib.makeLibraryPath runtimeLibs;
25 name = "factor-shell-env";
26 LD_LIBRARY_PATH = runtimeLibPath ;
27 buildInputs = runtimeLibs ++ [
35 [ -n "$1" ] || { printf "Usage: wrapFactor <factor-root>" ; return; }
36 local root="$(realpath $1)"
37 local binary="''${root}/factor"
38 local wrapped="''${root}/.factor-wrapped"
39 # Remove the wrapped binary if a new VM has been compiled
40 ${lib.getBin file}/bin/file $binary |grep ELF >/dev/null && rm -f "$wrapped"
41 # Restore the factor binary if it was already wrapped
42 [ -e "$wrapped" ] && { mv "$wrapped" "$binary" ; }
43 wrapProgram "$binary" --prefix LD_LIBRARY_PATH : ${runtimeLibPath} \
45 ln -sf "''${root}/factor.image" "''${root}/.factor-wrapped.image"