fix(nix/buildLisp): Don't load binaries in sbclWith

Adds an attribute on each Lisp derivation that specifies whether it is
a binary or not. This attribute is then filtered for in sbclWith.
This commit is contained in:
Vincent Ambo 2020-01-17 16:41:57 +00:00
parent e1cc4966b7
commit 21e9a65a35

View file

@ -8,7 +8,7 @@
, ... }: , ... }:
let let
inherit (builtins) map elemAt match; inherit (builtins) map elemAt match filter;
inherit (pkgs.third_party) lib runCommandNoCC makeWrapper writeText writeShellScriptBin sbcl; inherit (pkgs.third_party) lib runCommandNoCC makeWrapper writeText writeShellScriptBin sbcl;
# #
@ -130,6 +130,7 @@ let
'' // { '' // {
inherit lispNativeDeps lispDeps; inherit lispNativeDeps lispDeps;
lispName = name; lispName = name;
lispBinary = false;
}; };
# 'program' creates an executable containing a dumped image of the # 'program' creates an executable containing a dumped image of the
@ -153,11 +154,18 @@ let
} }
wrapProgram $out/bin/${name} --prefix LD_LIBRARY_PATH : "${libPath}" wrapProgram $out/bin/${name} --prefix LD_LIBRARY_PATH : "${libPath}"
'' // { lispName = name; lispDeps = [ selfLib ]; lispNativeDeps = []; }; '' // {
lispName = name;
lispDeps = [ selfLib ];
lispNativeDeps = native;
lispBinary = true;
};
# 'sbclWith' creates an image with the specified libraries / # 'sbclWith' creates an image with the specified libraries /
# programs loaded. # programs loaded.
sbclWith = deps: let lispDeps = allDeps deps; in writeShellScriptBin "sbcl" '' sbclWith = deps:
let lispDeps = filter (d: !d.lispBinary) (allDeps deps);
in writeShellScriptBin "sbcl" ''
export LD_LIBRARY_PATH=${lib.makeLibraryPath (allNative [] lispDeps)}; export LD_LIBRARY_PATH=${lib.makeLibraryPath (allNative [] lispDeps)};
exec ${sbcl}/bin/sbcl ${ exec ${sbcl}/bin/sbcl ${
if deps == [] then "" if deps == [] then ""