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 = o.installPhase + ''
270 mkdir -p $out/bin
271 mv $out/clfswm $out/bin
272 '';
273 });
274
275 magicl = build-with-compile-into-pwd {
276 inherit (super.magicl)
277 pname
278 version
279 src
280 lispLibs
281 ;
282 nativeBuildInputs = [ pkgs.gfortran ];
283 nativeLibs = [ pkgs.openblas ];
284 };
285
286 cl-gtk4 = build-asdf-system {
287 pname = "cl-gtk4";
288 version = "1.0.0";
289 src = pkgs.fetchFromGitHub {
290 owner = "bohonghuang";
291 repo = "cl-gtk4";
292 rev = "ff60e3495cdbba5c09d0bb8aa49f3184cc060c8e";
293 hash = "sha256-06cyPf+5z+GE3YvZEJ67kC281nkwRz/hoaykTISsni0=";
294 };
295 lispLibs = with self; [
296 cl-gobject-introspection-wrapper
297 cl-glib
298 cl-gio
299 cl-gobject
300 ];
301 nativeBuildInputs = [
302 pkgs.gobject-introspection
303 pkgs.gtk4
304 ];
305 nativeLibs = [
306 pkgs.gtk4
307 ];
308 };
309
310 cl-gtk4_dot_adw = build-asdf-system {
311 pname = "cl-gtk4.adw";
312 version = self.cl-gtk4.version;
313 src = self.cl-gtk4.src;
314 lispLibs = with self; [
315 cl-gobject-introspection-wrapper
316 cl-gtk4
317 ];
318 nativeBuildInputs = [
319 pkgs.libadwaita
320 ];
321 nativeLibs = [
322 pkgs.libadwaita
323 ];
324 };
325
326 cl-gtk4_dot_webkit = build-asdf-system {
327 pname = "cl-gtk4.webkit";
328 version = self.cl-gtk4.version;
329 src = self.cl-gtk4.src;
330 lispLibs = with self; [
331 cl-gobject-introspection-wrapper
332 cl-gtk4
333 ];
334 nativeBuildInputs = [
335 pkgs.webkitgtk_6_0
336 ];
337 nativeLibs = [
338 pkgs.webkitgtk_6_0
339 ];
340 };
341
342 cl-avro = build-asdf-system {
343 pname = "cl-avro";
344 version = "trunk";
345 src = pkgs.fetchFromGitHub {
346 owner = "SahilKang";
347 repo = "cl-avro";
348 rev = "b8fa26320fa0ae88390215140d57f9cca937f691";
349 hash = "sha256-acXsotvKWuffrLbrG9YJ8yZc5E6WC8N0qCFCAiX6N0Q=";
350 };
351 lispLibs = with self; [
352 alexandria
353 babel
354 chipz
355 closer-mop
356 ieee-floats
357 flexi-streams
358 local-time
359 local-time-duration
360 md5
361 salza2
362 st-json
363 time-interval
364 trivial-extensible-sequences
365 ];
366 };
367
368 frugal-uuid = super.frugal-uuid.overrideLispAttrs (o: {
369 systems = [
370 "frugal-uuid"
371 "frugal-uuid/non-frugal"
372 "frugal-uuid/benchmark"
373 "frugal-uuid/test"
374 ];
375 lispLibs =
376 o.lispLibs
377 ++ (with self; [
378 ironclad
379 babel
380 trivial-clock
381 trivial-benchmark
382 fiveam
383 ]);
384 });
385
386 duckdb = super.duckdb.overrideLispAttrs (o: {
387 systems = [
388 "duckdb"
389 "duckdb/test"
390 "duckdb/benchmark"
391 ];
392 });
393
394 polyclot = build-asdf-system {
395 pname = "polyclot";
396 version = "trunk";
397 src = pkgs.fetchfossil {
398 url = "https://fossil.turtleware.eu/fossil.turtleware.eu/polyclot";
399 rev = "18500c968b1fc1e2a915b5c70b8cddc4a2b54de51da4eedc5454e42bfea3b479";
400 sha256 = "sha256-KgBL1QQN4iG6d8E9GlKAuxSwkrY6Zy7e1ZzEDGKad+A=";
401 };
402 systems = [
403 "eu.turtleware.polyclot"
404 "eu.turtleware.polyclot/demo"
405 ];
406 lispLibs = with self; [
407 clim
408 mcclim
409 mcclim-layouts
410 ];
411 };
412
413 kons-9 = build-asdf-system {
414 pname = "kons-9";
415 version = "trunk";
416 src = pkgs.fetchFromGitHub {
417 owner = "kaveh808";
418 repo = "kons-9";
419 rev = "08770e7fbb839b91fd035f1cd4a50ecc81b42d57";
420 sha256 = "sha256-Tit/qmOU5+zp43/ecIXGbh4CtgWzltWM7tHdVWkga0k=";
421 };
422 systems = [
423 "kons-9"
424 "kons-9/testsuite"
425 ];
426 patches = [ ./patches/kons-9-fix-testsuite-compilation.patch ];
427 lispLibs = with self; [
428 closer-mop
429 trivial-main-thread
430 trivial-backtrace
431 cffi
432 cl-opengl
433 cl-glu
434 cl-glfw3
435 cl-paths-ttf
436 zpb-ttf
437 cl-vectors
438 origin
439 clobber
440 shasht
441 org_dot_melusina_dot_confidence
442 ];
443 };
444
445 nsb-cga = super.nsb-cga.overrideLispAttrs (oa: {
446 lispLibs = oa.lispLibs ++ [ self.sb-cga ];
447 });
448
449 qlot-cli = build-asdf-system rec {
450 pname = "qlot";
451 version = "1.5.2";
452
453 src = pkgs.fetchFromGitHub {
454 owner = "fukamachi";
455 repo = "qlot";
456 rev = "refs/tags/${version}";
457 hash = "sha256-j9iT25Yz9Z6llCKwwiHlVNKLqwuKvY194LrAzXuljsE=";
458 };
459
460 lispLibs = with self; [
461 archive
462 deflate
463 dexador
464 fuzzy-match
465 ironclad
466 lparallel
467 yason
468 ];
469
470 nativeLibs = [
471 pkgs.openssl
472 ];
473
474 nativeBuildInputs = [
475 pkgs.makeWrapper
476 ];
477
478 buildScript = pkgs.writeText "build-qlot-cli" ''
479 (load "${self.qlot-cli.asdfFasl}/asdf.${self.qlot-cli.faslExt}")
480 (asdf:load-system :qlot/command)
481 (asdf:load-system :qlot/subcommands)
482
483 ;; Use uiop:dump-image instead of sb-ext:dump-image for the image restore hooks
484 (setf uiop:*image-entry-point* #'qlot/cli:main)
485 (uiop:dump-image "qlot"
486 :executable t
487 #+sb-core-compression :compression
488 #+sb-core-compression t)
489 '';
490
491 installPhase = ''
492 runHook preInstall
493
494 mkdir -p $out/bin
495 cp qlot.asd $out
496 rm *.asd
497 cp -r * $out
498
499 mv $out/qlot $out/bin
500 wrapProgram $out/bin/qlot \
501 --prefix LD_LIBRARY_PATH : $LD_LIBRARY_PATH
502
503 runHook postInstall
504 '';
505
506 meta.mainProgram = "qlot";
507 };
508
509 fset = super.fset.overrideLispAttrs (oa: {
510 systems = [
511 "fset"
512 "fset/test"
513 ];
514 meta = {
515 description = "Functional collections library";
516 homepage = "https://gitlab.common-lisp.net/fset/fset/-/wikis/home";
517 license = pkgs.lib.licenses.llgpl21;
518 };
519 });
520
521 thih-coalton = self.coalton;
522 quil-coalton = self.coalton;
523 coalton = super.coalton.overrideLispAttrs (oa: {
524 systems = [
525 "coalton"
526 "thih-coalton"
527 "quil-coalton"
528 "thih-coalton/tests"
529 "quil-coalton/tests"
530 "coalton/tests"
531 ];
532 lispLibs = oa.lispLibs ++ [ self.fiasco ];
533 nativeLibs = [ pkgs.mpfr ];
534 meta = {
535 description = "Statically typed functional programming language that supercharges Common Lisp";
536 homepage = "https://coalton-lang.github.io";
537 license = pkgs.lib.licenses.mit;
538 };
539 });
540
541 }
542 // optionalAttrs pkgs.config.allowAliases {
543 cl-glib_dot_gio = throw "cl-glib_dot_gio was replaced by cl-gio";
544 cl-gtk4_dot_webkit2 = throw "cl-gtk4_dot_webkit2 was replaced by cl-gtk4_dot_webkit";
545 stumpwm-unwrapped = throw "stumpwm-unwrapped is now just stumpwm";
546 }
547 );
548
549in
550packages