]> gitweb.factorcode.org Git - factor.git/blobdiff - shell.nix
Added UTExportedTypeDeclarations to Info.plist
[factor.git] / shell.nix
index 458964dc7ff7193b57d329bc1bc4d24d46ce205f..b9d4a136b0a5de7de38a88be1e78bbe29c878359 100644 (file)
--- a/shell.nix
+++ b/shell.nix
@@ -1,20 +1,39 @@
 { pkgs ? import <nixpkgs> {} }:
-(pkgs.buildFHSUserEnv {
-  name = "factor";
-  targetPkgs = pkgs: (with pkgs; [
-    # for running factor
-    gtk2-x11
+with pkgs;
+let
+  mkClangShell = mkShell.override { stdenv = clangStdenv; };
+  runtimeLibs = with xorg; [
     glib
+    pango cairo
+    gtk2-x11
     gdk_pixbuf
-    gnome2.pango
-    cairo
     gnome2.gtkglext
-
+    pcre
+    mesa_glu
+    freealut
+    openssl
+    udis86 # available since NixOS 19.09
+    openal
+  ];
+  runtimeLibPath = lib.makeLibraryPath runtimeLibs;
+in
+(mkClangShell {
+  name = "factor-shell-env";
+  LD_LIBRARY_PATH = "/run/opengl-driver/lib:${runtimeLibPath}" ;
+  buildInputs = runtimeLibs ++ [
     # for building factor
-    clang
     git
     curl
-    binutils
-  ]);
-  runScript = "bash";
-}).env
+    makeWrapper
+  ];
+  shellHook = ''
+    wrapFactor () {
+    [ -n "$1" ] || { printf "Usage: wrapFactor <factor-root>" ; return; }
+    local root="$(realpath $1)"
+    local binary="''${root}/factor"
+    wrapProgram "$binary" --prefix LD_LIBRARY_PATH : ${runtimeLibPath} \
+      --argv0 factor
+    ln -sf "''${root}/factor.image" "''${root}/.factor-wrapped.image"
+    }
+  '';
+})