nixpkgs/pkgs/development/lisp-modules/quicklisp-to-nix-overrides.nix
Brad Jensen f0c8027ae3 Overhaul quicklisp-to-nix
1. Detect (and automatically handle) parasitic systems.
2. Each nix package has only one asd, and (almost) every parasitic
   package inside it builds.
3. Ensure that parasitic systems are compiled.
4. Remove unnecessary testnames lisp override mechanism (the
   testnae/testSystem is replaced by parasites/buildSystems).
5. Parasitic systems (if included in the system closure) become
   aliases to their host package.
6. Support caching fasl files in a known directory (for faster
   re-generation after modifying quicklisp-to-nix-system-info).
7. Eliminate unnecessary overrides.  We're going to determine ALL
   lisp dependencies correctly.
8. Don't try to "build" lisp packages with make.  lispPackages should
   be about bringing in a lisp library.
9. Eliminate the hand-maintained list of aliases.  Parasites should
   become aliases.  Everything else should be a real package.
2017-08-31 20:10:18 -07:00

104 lines
3.4 KiB
Nix

{pkgs, buildLispPackage, clwrapper, quicklisp-to-nix-packages}:
let
addDeps = newdeps: x: {deps = x.deps ++ newdeps;};
addNativeLibs = libs: x: { propagatedBuildInputs = libs; };
skipBuildPhase = x: {
overrides = y: ((x.overrides y) // { buildPhase = "true"; });
};
multiOverride = l: x: if l == [] then {} else
((builtins.head l) x) // (multiOverride (builtins.tail l) x);
in
{
stumpwm = x:{
overrides = y: (x.overrides y) // {
preConfigure = ''
export configureFlags="$configureFlags --with-$NIX_LISP=common-lisp.sh";
'';
postInstall = ''
"$out/bin/stumpwm-lisp-launcher.sh" --eval '(asdf:make :stumpwm)' \
--eval '(setf (asdf/system:component-entry-point (asdf:find-system :stumpwm)) (function stumpwm:stumpwm))' \
--eval '(asdf:perform (quote asdf:program-op) :stumpwm)'
cp "$out/lib/common-lisp/stumpwm/stumpwm" "$out/bin"
'';
};
};
iterate = skipBuildPhase;
cl-fuse = x: {
propagatedBuildInputs = [pkgs.fuse];
overrides = y : (x.overrides y) // {
configurePhase = ''
export SAVED_CL_SOURCE_REGISTRY="$CL_SOURCE_REGISTRY"
export CL_SOURCE_REGISTRY="$CL_SOURCE_REGISTRY:$PWD"
export makeFlags="$makeFlags LISP=common-lisp.sh"
'';
preInstall = ''
export CL_SOURCE_REGISTRY="$SAVED_CL_SOURCE_REGISTRY"
'';
};
};
hunchentoot = addNativeLibs [pkgs.openssl];
iolib = x: rec {
propagatedBuildInputs = (x.propagatedBuildInputs or [])
++ (with pkgs; [libfixposix gcc])
;
};
cxml = skipBuildPhase;
wookie = addNativeLibs (with pkgs; [libuv openssl]);
lev = addNativeLibs [pkgs.libev];
"cl+ssl" = addNativeLibs [pkgs.openssl];
cl-colors = skipBuildPhase;
cl-libuv = addNativeLibs [pkgs.libuv];
cl-async-ssl = addNativeLibs [pkgs.openssl];
cl-async-test = addNativeLibs [pkgs.openssl];
clsql = x: {
propagatedBuildInputs = with pkgs; [mysql postgresql sqlite zlib];
overrides = y: (x.overrides y) // {
preConfigure = ((x.overrides y).preConfigure or "") + ''
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I${pkgs.lib.getDev pkgs.mysql.client}/include/mysql"
export NIX_LDFLAGS="$NIX_LDFLAGS -L${pkgs.lib.getLib pkgs.mysql.client}/lib/mysql"
'';
};
};
clx-truetype = skipBuildPhase;
query-fs = x: {
overrides = y: (x.overrides y) // {
linkedSystems = [];
postInstall = ((x.overrides y).postInstall or "") + ''
export CL_SOURCE_REGISTRY="$CL_SOURCE_REGISTRY:$out/lib/common-lisp/query-fs"
export HOME=$PWD
build-with-lisp.sh sbcl \
":query-fs $(echo "$linkedSystems" | sed -re 's/(^| )([^ :])/ :\2/g')" \
"$out/bin/query-fs" \
"(query-fs:run-fs-with-cmdline-args)"
'';
};
};
cffi = addNativeLibs [pkgs.libffi];
cl-mysql = addNativeLibs [pkgs.mysql];
cl-ppcre-template = x: {
overrides = y: (x.overrides y) // {
postPatch = ''
ln -s lib-dependent/*.asd .
'';
};
};
sqlite = addNativeLibs [pkgs.sqlite];
uiop = x: {
parasites = (x.parasites or []) ++ [
"uiop/version"
];
overrides = y: (x.overrides y) // {
postInstall = ((x.overrides y).postInstall or "") + ''
cp -r "${pkgs.asdf}/lib/common-lisp/asdf/uiop/contrib" "$out/lib/common-lisp/uiop"
'';
};
};
cl-containers = x: {
overrides = y: (x.overrides y) // {
postConfigure = "rm GNUmakefile";
};
};
mssql = addNativeLibs [pkgs.freetds];
}