]> gitweb.factorcode.org Git - factor.git/blob - shell.nix
shell.nix: Add more runtime dependencies for nixos wrapper
[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     mesa_glu
13     freealut
14     openssl
15     udis86 # available since NixOS 19.09
16     openal
17     libogg
18     libvorbis
19     zlib
20   ];
21   runtimeLibPath = lib.makeLibraryPath runtimeLibs;
22 in
23 (mkClangShell {
24   name = "factor-shell-env";
25   LD_LIBRARY_PATH = "/run/opengl-driver/lib:${runtimeLibPath}" ;
26   buildInputs = runtimeLibs ++ [
27     # for building factor
28     git
29     curl
30     makeWrapper
31   ];
32   shellHook = ''
33     wrapFactor () {
34     [ -n "$1" ] || { printf "Usage: wrapFactor <factor-root>" ; return; }
35     local root="$(realpath $1)"
36     local binary="''${root}/factor"
37     wrapProgram "$binary" --prefix LD_LIBRARY_PATH : ${runtimeLibPath} \
38       --argv0 factor
39     ln -sf "''${root}/factor.image" "''${root}/.factor-wrapped.image"
40     }
41   '';
42 })