]> gitweb.factorcode.org Git - factor.git/blob - shell.nix
shell.nix: use correct opengl dependencies, fix runtime lib path
[factor.git] / shell.nix
1 { pkgs ? import <nixpkgs> {} }:
2 with pkgs;
3 let
4   mkClangShell = mkShell.override { stdenv = clangStdenv; };
5   runtimeLibs = with xorg; [
6     glib
7     pango cairo
8     gtk2-x11
9     gdk_pixbuf
10     gnome2.gtkglext
11     pcre
12     libGL
13     libGLU
14     freealut
15     openssl
16     udis86 # available since NixOS 19.09
17     openal
18     libogg
19     libvorbis
20     zlib
21   ];
22   runtimeLibPath = "/run/opengl-driver/lib:" + lib.makeLibraryPath runtimeLibs;
23 in
24 (mkClangShell {
25   name = "factor-shell-env";
26   LD_LIBRARY_PATH = runtimeLibPath ;
27   buildInputs = runtimeLibs ++ [
28     # for building factor
29     git
30     curl
31     makeWrapper
32   ];
33   shellHook = ''
34     wrapFactor () {
35     [ -n "$1" ] || { printf "Usage: wrapFactor <factor-root>" ; return; }
36     local root="$(realpath $1)"
37     local binary="''${root}/factor"
38     wrapProgram "$binary" --prefix LD_LIBRARY_PATH : ${runtimeLibPath} \
39       --argv0 factor
40     ln -sf "''${root}/factor.image" "''${root}/.factor-wrapped.image"
41     }
42   '';
43 })