lol
1{ lib
2, stdenv
3, fetchgit
4, wrapLisp
5, openssl
6, sbcl
7}:
8
9# Broken on newer versions:
10# "https://gitlab.common-lisp.net/clpm/clpm/-/issues/51". Once that bug is
11# fixed, remove this, and all 2.1.9 references from the SBCL build file.
12with rec {
13 sbcl_2_1_9 = sbcl.override (_: {
14 version = "2.1.9";
15 });
16};
17
18
19stdenv.mkDerivation rec {
20 pname = "clpm";
21 version = "0.4.1";
22
23 src = fetchgit {
24 url = "https://gitlab.common-lisp.net/clpm/clpm";
25 rev = "v${version}";
26 fetchSubmodules = true;
27 sha256 = "sha256-UhaLmbdsIPj6O+s262HUMxuz/5t43JR+TlOjq8Y2CDs=";
28 };
29
30 propagatedBuildInputs = [
31 openssl
32 ];
33
34 postPatch = ''
35 # patch cl-plus-ssl to ensure that it finds libssl and libcrypto
36 sed 's|libssl.so|${lib.getLib openssl}/lib/libssl.so|' -i ext/cl-plus-ssl/src/reload.lisp
37 sed 's|libcrypto.so|${lib.getLib openssl}/lib/libcrypto.so|' -i ext/cl-plus-ssl/src/reload.lisp
38 # patch dexador to avoid error due to dexador being loaded multiple times
39 sed -i 's/defpackage/uiop:define-package/g' ext/dexador/src/dexador.lisp
40 '';
41
42 buildPhase = ''
43 runHook preBuild
44
45 # exporting home to avoid using /homeless-shelter/.cache/ as this will cause
46 # ld to complaing about `impure path used in link`.
47 export HOME=$TMP
48
49 ${sbcl_2_1_9}/bin/sbcl --script scripts/build-release.lisp
50
51 runHook postBuild
52 '';
53
54 installPhase = ''
55 runHook preInstall
56
57 cd build/release-staging/dynamic/clpm-${version}*/
58 INSTALL_ROOT=$out/ bash install.sh
59
60 runHook postInstall
61 '';
62
63 # Stripping binaries results in fatal error in SBCL, `Can't find sbcl.core`
64 dontStrip = true;
65
66 meta = with lib; {
67 description = "Common Lisp Package Manager";
68 homepage = "https://www.clpm.dev/";
69 license = licenses.bsd2;
70 maintainers = [ maintainers.petterstorvik ];
71 platforms = [ "i686-linux" "x86_64-linux" ];
72 };
73}