nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{stdenv, fetchurl, asdf, which, lisp ? null}:
2stdenv.mkDerivation {
3 name = "cl-wrapper-script";
4
5 buildPhase="";
6
7 installPhase=''
8 mkdir -p "$out"/bin
9 export head="$(which head)"
10 export ls="$(which ls)"
11 substituteAll ${./common-lisp.sh} "$out"/bin/common-lisp.sh
12 substituteAll "${./build-with-lisp.sh}" "$out/bin/build-with-lisp.sh"
13 substituteAll "${./cl-wrapper.sh}" "$out/bin/cl-wrapper.sh"
14 chmod a+x "$out"/bin/*
15
16 substituteAll "${./setup-hook.sh}" "setup-hook-parsed"
17 source setup-hook-parsed
18 setLisp "${lisp}"
19 echo "$NIX_LISP"
20
21 mkdir -p "$out/lib/common-lisp/"
22 cp -r "${asdf}/lib/common-lisp"/* "$out/lib/common-lisp/"
23 chmod u+rw -R "$out/lib/common-lisp/"
24
25 NIX_LISP_PRELAUNCH_HOOK='
26 NIX_LISP_FASL_TYPE=lisp
27 nix_lisp_run_single_form "(progn
28 (uiop/lisp-build:compile-file* \"'"$out"'/lib/common-lisp/asdf/build/asdf.lisp\")
29 (asdf:load-system :uiop :force :all)
30 (asdf:load-system :asdf :force :all)
31 (ignore-errors (asdf:load-system :uiop/version :force :all))
32 )"' \
33 "$out/bin/common-lisp.sh"
34 '';
35
36 buildInputs = [which];
37
38 inherit asdf lisp;
39 stdenv_shell = stdenv.shell;
40
41 setupHook = ./setup-hook.sh;
42
43 phases="installPhase fixupPhase";
44
45 ASDF_OUTPUT_TRANSLATIONS="${builtins.storeDir}/:${builtins.storeDir}";
46
47 passthru = {
48 inherit lisp;
49 };
50
51 meta = {
52 description = ''Script used to wrap Common Lisp implementations'';
53 maintainers = [stdenv.lib.maintainers.raskin];
54 };
55}