2013-10-13 07:57:30 +01:00
|
|
|
args @ {stdenv, clwrapper, baseName, version ? "latest", src, description, deps,
|
2014-11-13 08:17:17 +00:00
|
|
|
buildInputs ? [], meta ? {}, overrides?(x: {}), propagatedBuildInputs ? []}:
|
2013-10-13 07:57:30 +01:00
|
|
|
let
|
|
|
|
deployConfigScript = ''
|
|
|
|
config_script="$out"/lib/common-lisp-settings/${args.baseName}-shell-config.sh
|
|
|
|
mkdir -p "$(dirname "$config_script")"
|
|
|
|
touch "$config_script"
|
|
|
|
chmod a+x "$config_script"
|
|
|
|
echo "export NIX_LISP_COMMAND='$NIX_LISP_COMMAND'" >> "$config_script"
|
|
|
|
echo "export NIX_LISP_ASDF='$NIX_LISP_ASDF'" >> "$config_script"
|
|
|
|
echo "export CL_SOURCE_REGISTRY="\$CL_SOURCE_REGISTRY\''${CL_SOURCE_REGISTRY:+:}"'$CL_SOURCE_REGISTRY:$out/lib/common-lisp/${args.baseName}/'" >> "$config_script"
|
2013-10-29 07:29:46 +00:00
|
|
|
test -n "$LD_LIBRARY_PATH" &&
|
|
|
|
echo "export LD_LIBRARY_PATH=\"\$LD_LIBRARY_PATH\''${LD_LIBRARY_PATH:+:}\"'$LD_LIBRARY_PATH'" >> "$config_script"
|
|
|
|
test -n "$NIX_LISP_LD_LIBRARY_PATH" &&
|
|
|
|
echo "export NIX_LISP_LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\"'$NIX_LISP_LD_LIBRARY_PATH'" >> "$config_script"
|
2013-10-13 07:57:30 +01:00
|
|
|
'';
|
|
|
|
deployLaunchScript = ''
|
|
|
|
launch_script="$out"/bin/${args.baseName}-lisp-launcher.sh
|
|
|
|
mkdir -p "$(dirname "$launch_script")"
|
|
|
|
touch "$launch_script"
|
|
|
|
chmod a+x "$launch_script"
|
|
|
|
echo "#! /bin/sh" >> "$launch_script"
|
|
|
|
echo "source '$config_script'" >> "$launch_script"
|
2013-10-29 07:29:46 +00:00
|
|
|
echo "export LD_LIBRARY_PATH=\"\$NIX_LISP_LD_LIBRARY_PATH\''${NIX_LISP_LD_LIBRARY_PATH:+:}\$LD_LIBRARY_PATH\"" >> "$launch_script"
|
2013-10-13 07:57:30 +01:00
|
|
|
echo '"${clwrapper}/bin/common-lisp.sh" "$@"' >> "$launch_script"
|
|
|
|
'';
|
|
|
|
basePackage = {
|
|
|
|
name = "lisp-${baseName}-${version}";
|
|
|
|
inherit src;
|
|
|
|
|
|
|
|
inherit deployConfigScript deployLaunchScript;
|
|
|
|
installPhase = ''
|
2014-11-16 16:08:00 +00:00
|
|
|
eval "$preInstall"
|
|
|
|
|
2013-10-13 07:57:30 +01:00
|
|
|
mkdir -p "$out"/share/doc/${args.baseName};
|
|
|
|
mkdir -p "$out"/lib/common-lisp/${args.baseName};
|
|
|
|
cp -r . "$out"/lib/common-lisp/${args.baseName};
|
|
|
|
cp -rf doc/* LICENCE LICENSE COPYING README README.html README.md readme.html "$out"/share/doc/${args.baseName} || true
|
|
|
|
|
|
|
|
${deployConfigScript}
|
|
|
|
${deployLaunchScript}
|
2014-11-16 16:08:00 +00:00
|
|
|
|
|
|
|
eval "$postInstall"
|
2013-10-13 07:57:30 +01:00
|
|
|
'';
|
2014-11-13 08:17:17 +00:00
|
|
|
propagatedBuildInputs = (args.deps or []) ++ [clwrapper clwrapper.lisp]
|
|
|
|
++ (args.propagatedBuildInputs or []);
|
2013-10-13 07:57:30 +01:00
|
|
|
buildInputs = buildInputs;
|
|
|
|
dontStrip=true;
|
|
|
|
meta = {
|
|
|
|
inherit description version;
|
|
|
|
} // meta;
|
|
|
|
};
|
|
|
|
package = basePackage // (overrides basePackage);
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation package
|