1{
2 build-asdf-system,
3 spec,
4 quicklispPackagesFor,
5 stdenv,
6 pkgs,
7 ...
8}:
9
10let
11
12 inherit (pkgs.lib)
13 head
14 makeLibraryPath
15 makeSearchPath
16 setAttr
17 hasAttr
18 optionals
19 optionalAttrs
20 isDerivation
21 hasSuffix
22 splitString
23 remove
24 ;
25
26 # Used by builds that would otherwise attempt to write into storeDir.
27 #
28 # Will run build two times, keeping all files created during the
29 # first run, exept the FASL's. Then using that directory tree as the
30 # source of the second run.
31 #
32 # E.g. cl-unicode creating .txt files during compilation
33 build-with-compile-into-pwd =
34 args:
35 let
36 args' = if isDerivation args then args.drvAttrs else args;
37 build = (build-asdf-system (args' // { version = args'.version + "-build"; })).overrideAttrs (o: {
38 buildPhase = with builtins; ''
39 runHook preBuild
40
41 mkdir __fasls
42 export ASDF_OUTPUT_TRANSLATIONS="$(pwd):$(pwd)/__fasls:${storeDir}:${storeDir}"
43 export CL_SOURCE_REGISTRY=$CL_SOURCE_REGISTRY:$(pwd)//
44 ${o.pkg}/bin/${o.program} ${toString (o.flags or [ ])} < ${o.buildScript}
45
46 runHook postBuild
47 '';
48 installPhase = ''
49 runHook preInstall
50
51 mkdir -pv $out
52 rm -rf __fasls
53 cp -r * $out
54
55 runHook postInstall
56 '';
57 });
58 in
59 build-asdf-system (
60 args'
61 // {
62 # Patches are already applied in `build`
63 patches = [ ];
64 postPatch = "";
65 src = build;
66 }
67 );
68
69 # Makes it so packages imported from Quicklisp can be re-used as
70 # lispLibs ofpackages in this file.
71 ql = quicklispPackagesFor spec;
72
73 packages = ql.overrideScope (
74 self: super:
75 {
76
77 cl-unicode = build-with-compile-into-pwd {
78 inherit (super.cl-unicode)
79 pname
80 version
81 src
82 systems
83 ;
84 lispLibs = super.cl-unicode.lispLibs ++ [ self.flexi-streams ];
85 };
86
87 jzon = super.com_dot_inuoe_dot_jzon;
88
89 cl-notify = build-asdf-system {
90 pname = "cl-notify";
91 version = "20080904-138ca7038";
92 src = pkgs.fetchzip {
93 url = "https://repo.or.cz/cl-notify.git/snapshot/138ca703861f4a1fbccbed557f92cf4d213668a1.tar.gz";
94 sha256 = "0k6ns6fzvjcbpsqgx85r4g5m25fvrdw9481i9vyabwym9q8bbqwx";
95 };
96 lispLibs = [
97 self.cffi
98 ];
99 nativeLibs = [
100 pkgs.libnotify
101 ];
102 };
103
104 cl-liballegro-nuklear = build-with-compile-into-pwd super.cl-liballegro-nuklear;
105
106 lessp = build-asdf-system {
107 pname = "lessp";
108 version = "0.2-f8a9e4664";
109 src = pkgs.fetchzip {
110 url = "https://github.com/facts-db/cl-lessp/archive/632217602b85b679e8d420654a0aa39e798ca3b5.tar.gz";
111 sha256 = "0i3ia14dzqwjpygd0zn785ff5vqnnmkn75psfpyx0ni3jr71lkq9";
112 };
113 };
114
115 rollback = build-asdf-system {
116 pname = "rollback";
117 version = "0.1-5d3f21fda";
118 src = pkgs.fetchzip {
119 url = "https://github.com/facts-db/cl-rollback/archive/5d3f21fda8f04f35c5e9d20ee3b87db767915d15.tar.gz";
120 sha256 = "12dpxsbm2al633y87i8p784k2dn4bbskz6sl40v9f5ljjmjqjzxf";
121 };
122 };
123
124 facts = build-asdf-system {
125 pname = "facts";
126 version = "0.1-632217602";
127 src = pkgs.fetchzip {
128 url = "https://beta.quicklisp.org/archive/cl-facts/2022-11-06/cl-facts-20221106-git.tgz";
129 sha256 = "sha256-PBpyyJYkq1NjKK9VikSAL4TmrGRwUJlEWRSeKj/f4Sc=";
130 };
131 lispLibs = [
132 self.lessp
133 self.rollback
134 self.local-time
135 ];
136 };
137
138 cl-fuse = build-with-compile-into-pwd {
139 inherit (super.cl-fuse)
140 pname
141 version
142 src
143 lispLibs
144 ;
145 nativeBuildInputs = [ pkgs.fuse ];
146 nativeLibs = [ pkgs.fuse ];
147 };
148
149 cl-containers = build-asdf-system {
150 inherit (super.cl-containers) pname version src;
151 lispLibs = super.cl-containers.lispLibs ++ [ self.moptilities ];
152 systems = [
153 "cl-containers"
154 "cl-containers/with-moptilities"
155 ];
156 };
157
158 swank = build-with-compile-into-pwd rec {
159 inherit (super.swank) pname lispLibs;
160 version = "2.29.1";
161 src = pkgs.fetchFromGitHub {
162 owner = "slime";
163 repo = "slime";
164 rev = "v${version}";
165 hash = "sha256-5hNB5XxbTER4HX3dn4umUGnw6UeiTQkczmggFz4uWoE=";
166 };
167 systems = [
168 "swank"
169 "swank/exts"
170 ];
171 patches = [ ./patches/swank-pure-paths.patch ];
172 postConfigure = ''
173 substituteAllInPlace swank-loader.lisp
174 '';
175 };
176
177 slynk = build-asdf-system {
178 pname = "slynk";
179 version = "trunk";
180 src = pkgs.fetchFromGitHub {
181 owner = "joaotavora";
182 repo = "sly";
183 rev = "ba40c8f054ec3b7040a6c36a1ef3e9596b936421";
184 hash = "sha256-hoaCZtyezuXptDPnAvBTT0SZ14M9Ifrmki3beBOwFmI=";
185 };
186 systems = [
187 "slynk"
188 "slynk/arglists"
189 "slynk/fancy-inspector"
190 "slynk/package-fu"
191 "slynk/mrepl"
192 "slynk/trace-dialog"
193 "slynk/profiler"
194 "slynk/stickers"
195 "slynk/indentation"
196 "slynk/retro"
197 ];
198 };
199
200 cephes = build-with-compile-into-pwd {
201 inherit (super.cephes)
202 pname
203 version
204 src
205 lispLibs
206 ;
207 patches = [ ./patches/cephes-make.patch ];
208 postPatch = ''
209 find \( -name '*.dll' -o -name '*.dylib' -o -name '*.so' \) -delete
210 '';
211 postConfigure = ''
212 substituteAllInPlace cephes.asd
213 '';
214 postInstall = ''
215 find $out -name '*.o' -delete
216 '';
217 };
218
219 clx-truetype = build-asdf-system {
220 pname = "clx-truetype";
221 version = "20160825-git";
222 src = pkgs.fetchzip {
223 url = "http://beta.quicklisp.org/archive/clx-truetype/2016-08-25/clx-truetype-20160825-git.tgz";
224 sha256 = "079hyp92cjkdfn6bhkxsrwnibiqbz4y4af6nl31lzw6nm91j5j37";
225 };
226 lispLibs = with self; [
227 alexandria
228 bordeaux-threads
229 cl-aa
230 cl-fad
231 cl-paths
232 cl-paths-ttf
233 cl-store
234 cl-vectors
235 clx
236 trivial-features
237 zpb-ttf
238 ];
239 };
240
241 mathkit = build-asdf-system {
242 inherit (super.mathkit)
243 pname
244 version
245 src
246 asds
247 ;
248 lispLibs = super.mathkit.lispLibs ++ [ super.sb-cga ];
249 };
250
251 stumpwm = super.stumpwm.overrideLispAttrs {
252 inherit (pkgs.stumpwm) src version;
253 meta = {
254 inherit (pkgs.stumpwm.meta) description license homepage;
255 };
256 };
257
258 clfswm = super.clfswm.overrideAttrs (o: {
259 buildScript = pkgs.writeText "build-clfswm.lisp" ''
260 (load "${o.asdfFasl}/asdf.${o.faslExt}")
261 (asdf:load-system 'clfswm)
262 (sb-ext:save-lisp-and-die
263 "clfswm"
264 :executable t
265 #+sb-core-compression :compression
266 #+sb-core-compression t
267 :toplevel #'clfswm:main)
268 '';
269 installPhase =
270 o.installPhase
271 + ''
272 mkdir -p $out/bin
273 mv $out/clfswm $out/bin
274 '';
275 });
276
277 magicl = build-with-compile-into-pwd {
278 inherit (super.magicl)
279 pname
280 version
281 src
282 lispLibs
283 ;
284 nativeBuildInputs = [ pkgs.gfortran ];
285 nativeLibs = [ pkgs.openblas ];
286 };
287
288 cl-gtk4 = build-asdf-system {
289 pname = "cl-gtk4";
290 version = "1.0.0";
291 src = pkgs.fetchFromGitHub {
292 owner = "bohonghuang";
293 repo = "cl-gtk4";
294 rev = "ff60e3495cdbba5c09d0bb8aa49f3184cc060c8e";
295 hash = "sha256-06cyPf+5z+GE3YvZEJ67kC281nkwRz/hoaykTISsni0=";
296 };
297 lispLibs = with self; [
298 cl-gobject-introspection-wrapper
299 cl-glib
300 cl-gio
301 cl-gobject
302 ];
303 nativeBuildInputs = [
304 pkgs.gobject-introspection
305 pkgs.gtk4
306 ];
307 nativeLibs = [
308 pkgs.gtk4
309 ];
310 };
311
312 cl-gtk4_dot_adw = build-asdf-system {
313 pname = "cl-gtk4.adw";
314 version = self.cl-gtk4.version;
315 src = self.cl-gtk4.src;
316 lispLibs = with self; [
317 cl-gobject-introspection-wrapper
318 cl-gtk4
319 ];
320 nativeBuildInputs = [
321 pkgs.libadwaita
322 ];
323 nativeLibs = [
324 pkgs.libadwaita
325 ];
326 };
327
328 cl-gtk4_dot_webkit = build-asdf-system {
329 pname = "cl-gtk4.webkit";
330 version = self.cl-gtk4.version;
331 src = self.cl-gtk4.src;
332 lispLibs = with self; [
333 cl-gobject-introspection-wrapper
334 cl-gtk4
335 ];
336 nativeBuildInputs = [
337 pkgs.webkitgtk_6_0
338 ];
339 nativeLibs = [
340 pkgs.webkitgtk_6_0
341 ];
342 };
343
344 cl-avro = build-asdf-system {
345 pname = "cl-avro";
346 version = "trunk";
347 src = pkgs.fetchFromGitHub {
348 owner = "SahilKang";
349 repo = "cl-avro";
350 rev = "b8fa26320fa0ae88390215140d57f9cca937f691";
351 hash = "sha256-acXsotvKWuffrLbrG9YJ8yZc5E6WC8N0qCFCAiX6N0Q=";
352 };
353 lispLibs = with self; [
354 alexandria
355 babel
356 chipz
357 closer-mop
358 ieee-floats
359 flexi-streams
360 local-time
361 local-time-duration
362 md5
363 salza2
364 st-json
365 time-interval
366 trivial-extensible-sequences
367 ];
368 };
369
370 frugal-uuid = super.frugal-uuid.overrideLispAttrs (o: {
371 systems = [
372 "frugal-uuid"
373 "frugal-uuid/non-frugal"
374 "frugal-uuid/benchmark"
375 "frugal-uuid/test"
376 ];
377 lispLibs =
378 o.lispLibs
379 ++ (with self; [
380 ironclad
381 babel
382 trivial-clock
383 trivial-benchmark
384 fiveam
385 ]);
386 });
387
388 duckdb = super.duckdb.overrideLispAttrs (o: {
389 systems = [
390 "duckdb"
391 "duckdb/test"
392 "duckdb/benchmark"
393 ];
394 });
395
396 polyclot = build-asdf-system {
397 pname = "polyclot";
398 version = "trunk";
399 src = pkgs.fetchfossil {
400 url = "https://fossil.turtleware.eu/fossil.turtleware.eu/polyclot";
401 rev = "18500c968b1fc1e2a915b5c70b8cddc4a2b54de51da4eedc5454e42bfea3b479";
402 sha256 = "sha256-KgBL1QQN4iG6d8E9GlKAuxSwkrY6Zy7e1ZzEDGKad+A=";
403 };
404 systems = [
405 "eu.turtleware.polyclot"
406 "eu.turtleware.polyclot/demo"
407 ];
408 lispLibs = with self; [
409 clim
410 mcclim
411 mcclim-layouts
412 ];
413 };
414
415 kons-9 = build-asdf-system {
416 pname = "kons-9";
417 version = "trunk";
418 src = pkgs.fetchFromGitHub {
419 owner = "kaveh808";
420 repo = "kons-9";
421 rev = "08770e7fbb839b91fd035f1cd4a50ecc81b42d57";
422 sha256 = "sha256-Tit/qmOU5+zp43/ecIXGbh4CtgWzltWM7tHdVWkga0k=";
423 };
424 systems = [
425 "kons-9"
426 "kons-9/testsuite"
427 ];
428 patches = [ ./patches/kons-9-fix-testsuite-compilation.patch ];
429 lispLibs = with self; [
430 closer-mop
431 trivial-main-thread
432 trivial-backtrace
433 cffi
434 cl-opengl
435 cl-glu
436 cl-glfw3
437 cl-paths-ttf
438 zpb-ttf
439 cl-vectors
440 origin
441 clobber
442 shasht
443 org_dot_melusina_dot_confidence
444 ];
445 };
446
447 nsb-cga = super.nsb-cga.overrideLispAttrs (oa: {
448 lispLibs = oa.lispLibs ++ [ self.sb-cga ];
449 });
450
451 qlot-cli = build-asdf-system rec {
452 pname = "qlot";
453 version = "1.5.2";
454
455 src = pkgs.fetchFromGitHub {
456 owner = "fukamachi";
457 repo = "qlot";
458 rev = "refs/tags/${version}";
459 hash = "sha256-j9iT25Yz9Z6llCKwwiHlVNKLqwuKvY194LrAzXuljsE=";
460 };
461
462 lispLibs = with self; [
463 archive
464 deflate
465 dexador
466 fuzzy-match
467 ironclad
468 lparallel
469 yason
470 ];
471
472 nativeLibs = [
473 pkgs.openssl
474 ];
475
476 nativeBuildInputs = [
477 pkgs.makeWrapper
478 ];
479
480 buildScript = pkgs.writeText "build-qlot-cli" ''
481 (load "${self.qlot-cli.asdfFasl}/asdf.${self.qlot-cli.faslExt}")
482 (asdf:load-system :qlot/command)
483 (asdf:load-system :qlot/subcommands)
484
485 ;; Use uiop:dump-image instead of sb-ext:dump-image for the image restore hooks
486 (setf uiop:*image-entry-point* #'qlot/cli:main)
487 (uiop:dump-image "qlot"
488 :executable t
489 #+sb-core-compression :compression
490 #+sb-core-compression t)
491 '';
492
493 installPhase = ''
494 runHook preInstall
495
496 mkdir -p $out/bin
497 cp qlot.asd $out
498 rm *.asd
499 cp -r * $out
500
501 mv $out/qlot $out/bin
502 wrapProgram $out/bin/qlot \
503 --prefix LD_LIBRARY_PATH : $LD_LIBRARY_PATH
504
505 runHook postInstall
506 '';
507
508 meta.mainProgram = "qlot";
509 };
510
511 fset = super.fset.overrideLispAttrs (oa: {
512 systems = [
513 "fset"
514 "fset/test"
515 ];
516 meta = {
517 description = "functional collections library";
518 homepage = "https://gitlab.common-lisp.net/fset/fset/-/wikis/home";
519 license = pkgs.lib.licenses.llgpl21;
520 };
521 });
522
523 thih-coalton = self.coalton;
524 quil-coalton = self.coalton;
525 coalton = super.coalton.overrideLispAttrs (oa: {
526 systems = [
527 "coalton"
528 "thih-coalton"
529 "quil-coalton"
530 "thih-coalton/tests"
531 "quil-coalton/tests"
532 "coalton/tests"
533 ];
534 lispLibs = oa.lispLibs ++ [ self.fiasco ];
535 nativeLibs = [ pkgs.mpfr ];
536 meta = {
537 description = "statically typed functional programming language that supercharges Common Lisp";
538 homepage = "https://coalton-lang.github.io";
539 license = pkgs.lib.licenses.mit;
540 };
541 });
542
543 }
544 // optionalAttrs pkgs.config.allowAliases {
545 cl-glib_dot_gio = throw "cl-glib_dot_gio was replaced by cl-gio";
546 cl-gtk4_dot_webkit2 = throw "cl-gtk4_dot_webkit2 was replaced by cl-gtk4_dot_webkit";
547 stumpwm-unwrapped = throw "stumpwm-unwrapped is now just stumpwm";
548 }
549 );
550
551in
552packages