1{ build-asdf-system, spec, quicklispPackagesFor, pkgs, ... }:
2
3let
4
5 inherit (pkgs.lib)
6 head
7 makeLibraryPath
8 makeSearchPath
9 setAttr
10 hasAttr
11 optionals
12 hasSuffix
13 splitString
14 remove
15 ;
16
17 # Used by builds that would otherwise attempt to write into storeDir.
18 #
19 # Will run build two times, keeping all files created during the
20 # first run, exept the FASL's. Then using that directory tree as the
21 # source of the second run.
22 #
23 # E.g. cl-unicode creating .txt files during compilation
24 build-with-compile-into-pwd = args:
25 let
26 build = (build-asdf-system (args // { version = args.version + "-build"; }))
27 .overrideAttrs(o: {
28 buildPhase = with builtins; ''
29 mkdir __fasls
30 export ASDF_OUTPUT_TRANSLATIONS="$(pwd):$(pwd)/__fasls:${storeDir}:${storeDir}"
31 export CL_SOURCE_REGISTRY=$CL_SOURCE_REGISTRY:$(pwd)//
32 ${o.pkg}/bin/${o.program} ${toString (o.flags or [])} < ${o.buildScript}
33 '';
34 installPhase = ''
35 mkdir -pv $out
36 rm -rf __fasls
37 cp -r * $out
38 '';
39 });
40 in build-asdf-system (args // {
41 # Patches are already applied in `build`
42 patches = [];
43 src = build;
44 });
45
46 # A little hacky
47 isJVM = spec.pkg.pname == "abcl";
48
49 # Makes it so packages imported from Quicklisp can be re-used as
50 # lispLibs ofpackages in this file.
51 ql = quicklispPackagesFor spec;
52
53 packages = ql.overrideScope' (self: super: {
54
55 cffi = let
56 jna = pkgs.fetchMavenArtifact {
57 groupId = "net.java.dev.jna";
58 artifactId = "jna";
59 version = "5.9.0";
60 sha256 = "0qbis8acv04fi902qzak1mbagqaxcsv2zyp7b8y4shs5nj0cgz7a";
61 };
62 in build-asdf-system {
63 src = pkgs.fetchzip {
64 url = "http://beta.quicklisp.org/archive/cffi/2021-04-11/cffi_0.24.1.tgz";
65 sha256 = "17ryim4xilb1rzxydfr7595dnhqkk02lmrbkqrkvi9091shi4cj3";
66 };
67 version = "0.24.1";
68 pname = "cffi";
69 lispLibs = with super; [
70 alexandria
71 babel
72 trivial-features
73 ];
74 javaLibs = optionals isJVM [ jna ];
75 };
76
77 cffi-libffi = build-asdf-system {
78 inherit (super.cffi-libffi) pname version asds lispLibs nativeLibs nativeBuildInputs;
79 src = pkgs.fetchzip {
80 url = "https://github.com/cffi/cffi/archive/3f842b92ef808900bf20dae92c2d74232c2f6d3a.tar.gz";
81 sha256 = "1jilvmbbfrmb23j07lwmkbffc6r35wnvas5s4zjc84i856ccclm2";
82 };
83 };
84
85 cl-unicode = build-with-compile-into-pwd {
86 pname = "cl-unicode";
87 version = "0.1.6";
88 src = pkgs.fetchzip {
89 url = "https://github.com/edicl/cl-unicode/archive/refs/tags/v0.1.6.tar.gz";
90 sha256 = "0ykx2s9lqfl74p1px0ik3l2izd1fc9jd1b4ra68s5x34rvjy0hza";
91 };
92 systems = [ "cl-unicode" ];
93 lispLibs = with super; [
94 cl-ppcre
95 flexi-streams
96 ];
97 };
98
99 jzon = build-asdf-system {
100 src = pkgs.fetchzip {
101 url = "https://github.com/Zulu-Inuoe/jzon/archive/6b201d4208ac3f9721c461105b282c94139bed29.tar.gz";
102 sha256 = "01d4a78pjb1amx5amdb966qwwk9vblysm1li94n3g26mxy5zc2k3";
103 };
104 version = "0.0.0-20210905-6b201d4208";
105 pname = "jzon";
106 lispLibs = [
107 super.closer-mop
108 ];
109 systems = [ "com.inuoe.jzon" ];
110 };
111
112 cl-notify = build-asdf-system {
113 pname = "cl-notify";
114 version = "20080904-138ca7038";
115 src = pkgs.fetchzip {
116 url = "https://repo.or.cz/cl-notify.git/snapshot/138ca703861f4a1fbccbed557f92cf4d213668a1.tar.gz";
117 sha256 = "0k6ns6fzvjcbpsqgx85r4g5m25fvrdw9481i9vyabwym9q8bbqwx";
118 };
119 lispLibs = [
120 self.cffi
121 ];
122 nativeLibs = [
123 pkgs.libnotify
124 ];
125 };
126
127 cl-liballegro-nuklear = build-with-compile-into-pwd {
128 inherit (super.cl-liballegro-nuklear) pname version src;
129 nativeBuildInputs = [ pkgs.allegro5 ];
130 nativeLibs = [ pkgs.allegro5 ];
131 lispLibs = super.cl-liballegro-nuklear.lispLibs ++ [ super.cl-liballegro ];
132 patches = [ ./patches/cl-liballegro-nuklear-missing-dll.patch ];
133 };
134
135 tuple = build-asdf-system {
136 pname = "tuple";
137 version = "b74bd067d";
138 src = pkgs.fetchzip {
139 url = "https://fossil.galkowski.xyz/tuple/tarball/b74bd067d4533ac0/tuple.tar.gz";
140 sha256 = "0dk356vkv6kwwcmc3j08x7143549m94rd66rpkzq8zkb31cg2va8";
141 };
142 };
143
144 cl-tar-file = build-asdf-system {
145 pname = "cl-tar-file";
146 version = "v0.2.1";
147 src = pkgs.fetchzip {
148 url = let
149 rev = "0c10bc82f14702c97a26dc25ce075b5d3a2347d1";
150 in "https://gitlab.common-lisp.net/cl-tar/cl-tar-file/-/archive/${rev}/cl-tar-file-${rev}.tar.gz";
151 sha256 = "0i8j05fkgdqy4c4pqj0c68sh4s3klpx9kc5wp73qwzrl3xqd2svy";
152 };
153 lispLibs = with super; [
154 alexandria
155 babel
156 trivial-gray-streams
157 _40ants-doc
158 salza2
159 chipz
160 flexi-streams
161 parachute
162 ];
163 systems = [ "tar-file" "tar-file/test" ];
164 };
165
166 cl-tar = build-asdf-system {
167 pname = "cl-tar";
168 version = "v0.2.1";
169 src = pkgs.fetchzip {
170 url = let
171 rev = "7c6e07a10c93d9e311f087b5f6328cddd481669a";
172 in "https://gitlab.common-lisp.net/cl-tar/cl-tar/-/archive/${rev}/cl-tar-${rev}.tar.gz";
173 sha256 = "0wp23cs3i6a89dibifiz6559la5nk58d1n17xvbxq4nrl8cqsllf";
174 };
175 lispLibs = with super; [
176 alexandria
177 babel
178 local-time
179 split-sequence
180 _40ants-doc
181 parachute
182 osicat
183 ] ++ [ self.cl-tar-file ];
184 systems = [
185 "tar"
186 "tar/common-extract"
187 "tar/simple-extract"
188 "tar/extract"
189 "tar/create"
190 "tar/docs"
191 "tar/test"
192 "tar/create-test"
193 "tar/extract-test"
194 "tar/simple-extract-test"
195 ];
196 };
197
198 lessp = build-asdf-system {
199 pname = "lessp";
200 version = "0.2-f8a9e4664";
201 src = pkgs.fetchzip {
202 url = "https://github.com/facts-db/cl-lessp/archive/632217602b85b679e8d420654a0aa39e798ca3b5.tar.gz";
203 sha256 = "0i3ia14dzqwjpygd0zn785ff5vqnnmkn75psfpyx0ni3jr71lkq9";
204 };
205 };
206
207 rollback = build-asdf-system {
208 pname = "rollback";
209 version = "0.1-5d3f21fda";
210 src = pkgs.fetchzip {
211 url = "https://github.com/facts-db/cl-rollback/archive/5d3f21fda8f04f35c5e9d20ee3b87db767915d15.tar.gz";
212 sha256 = "12dpxsbm2al633y87i8p784k2dn4bbskz6sl40v9f5ljjmjqjzxf";
213 };
214 };
215
216 facts = build-asdf-system {
217 pname = "facts";
218 version = "0.1-632217602";
219 src = pkgs.fetchzip {
220 url = "https://beta.quicklisp.org/archive/cl-facts/2022-11-06/cl-facts-20221106-git.tgz";
221 sha256 = "sha256-PBpyyJYkq1NjKK9VikSAL4TmrGRwUJlEWRSeKj/f4Sc=";
222 };
223 lispLibs = [ self.lessp self.rollback ] ++ [ super.local-time ];
224 };
225
226 cl-fuse = build-with-compile-into-pwd {
227 inherit (super.cl-fuse) pname version src lispLibs;
228 nativeBuildInputs = [ pkgs.fuse ];
229 nativeLibs = [ pkgs.fuse ];
230 };
231
232 cl-containers = build-asdf-system {
233 inherit (super.cl-containers) pname version src;
234 lispLibs = super.cl-containers.lispLibs ++ [ super.moptilities ];
235 systems = [ "cl-containers" "cl-containers/with-moptilities" ];
236 };
237
238 swank = build-with-compile-into-pwd {
239 inherit (super.swank) pname version src lispLibs;
240 patches = [ ./patches/swank-pure-paths.patch ];
241 postConfigure = ''
242 substituteAllInPlace swank-loader.lisp
243 '';
244 };
245
246 clx-truetype = build-asdf-system {
247 pname = "clx-truetype";
248 version = "20160825-git";
249 src = pkgs.fetchzip {
250 url = "http://beta.quicklisp.org/archive/clx-truetype/2016-08-25/clx-truetype-20160825-git.tgz";
251 sha256 = "079hyp92cjkdfn6bhkxsrwnibiqbz4y4af6nl31lzw6nm91j5j37";
252 };
253 lispLibs = with super; [
254 alexandria bordeaux-threads cl-aa cl-fad cl-paths cl-paths-ttf
255 cl-store cl-vectors clx trivial-features zpb-ttf
256 ];
257 };
258
259 mathkit = build-asdf-system {
260 inherit (super.mathkit) pname version src asds ;
261 lispLibs = super.mathkit.lispLibs ++ [ super.sb-cga ];
262 };
263
264 nyxt-gtk = build-asdf-system {
265 inherit (super.nyxt) pname;
266 version = "2.2.4";
267
268 lispLibs = super.nyxt.lispLibs ++ (with super; [
269 cl-cffi-gtk cl-webkit2 mk-string-metrics cl-css
270 ]);
271
272 src = pkgs.fetchzip {
273 url = "https://github.com/atlas-engineer/nyxt/archive/2.2.4.tar.gz";
274 sha256 = "12l7ir3q29v06jx0zng5cvlbmap7p709ka3ik6x29lw334qshm9b";
275 };
276
277 nativeBuildInputs = [ pkgs.makeWrapper ];
278
279 buildInputs = [
280 # needed for GSETTINGS_SCHEMAS_PATH
281 pkgs.gsettings-desktop-schemas pkgs.glib pkgs.gtk3
282
283 # needed for XDG_ICON_DIRS
284 pkgs.gnome.adwaita-icon-theme
285 ];
286
287 buildScript = pkgs.writeText "build-nyxt.lisp" ''
288 (load "${super.nyxt.asdfFasl}/asdf.${super.nyxt.faslExt}")
289 (asdf:load-system :nyxt/gtk-application)
290 (sb-ext:save-lisp-and-die "nyxt" :executable t
291 #+sb-core-compression :compression
292 #+sb-core-compression t
293 :toplevel #'nyxt:entry-point)
294 '';
295
296 # Run with WEBKIT_FORCE_SANDBOX=0 if getting a runtime error
297 # See https://github.com/atlas-engineer/nyxt/issues/1781
298 # TODO(kasper): use wrapGAppsHook
299 installPhase = super.nyxt.installPhase + ''
300 rm -v $out/nyxt
301 mkdir -p $out/bin
302 cp -v nyxt $out/bin
303 wrapProgram $out/bin/nyxt \
304 --set WEBKIT_FORCE_SANDBOX 0 \
305 --prefix LD_LIBRARY_PATH : $LD_LIBRARY_PATH \
306 --prefix XDG_DATA_DIRS : $XDG_ICON_DIRS \
307 --prefix XDG_DATA_DIRS : $GSETTINGS_SCHEMAS_PATH \
308 --prefix GIO_EXTRA_MODULES ":" ${pkgs.dconf.lib}/lib/gio/modules/ \
309 --prefix GIO_EXTRA_MODULES ":" ${pkgs.glib-networking}/lib/gio/modules/
310 '';
311 };
312
313 nyxt = self.nyxt-gtk;
314
315 stumpwm = super.stumpwm.overrideLispAttrs (o: rec {
316 version = "22.11";
317 src = pkgs.fetchFromGitHub {
318 owner = "stumpwm";
319 repo = "stumpwm";
320 rev = version;
321 hash = "sha256-zXj17ucgyFhv7P0qEr4cYSVRPGrL1KEIofXWN2trr/M=";
322 };
323 buildScript = pkgs.writeText "build-stumpwm.lisp" ''
324 (load "${super.stumpwm.asdfFasl}/asdf.${super.stumpwm.faslExt}")
325
326 (asdf:load-system 'stumpwm)
327
328 ;; Prevents package conflict error
329 (when (uiop:version<= "3.1.5" (asdf:asdf-version))
330 (uiop:symbol-call '#:asdf '#:register-immutable-system :stumpwm)
331 (dolist (system-name (uiop:symbol-call '#:asdf
332 '#:system-depends-on
333 (asdf:find-system :stumpwm)))
334 (uiop:symbol-call '#:asdf '#:register-immutable-system system-name)))
335
336 ;; Prevents "cannot create /homeless-shelter" error
337 (asdf:disable-output-translations)
338
339 (sb-ext:save-lisp-and-die
340 "stumpwm"
341 :executable t
342 :purify t
343 #+sb-core-compression :compression
344 #+sb-core-compression t
345 :toplevel #'stumpwm:stumpwm)
346 '';
347 installPhase = ''
348 mkdir -p $out/bin
349 cp -v stumpwm $out/bin
350 '';
351 });
352
353 stumpwm-unwrapped = super.stumpwm;
354
355 ltk = super.ltk.overrideLispAttrs (o: {
356 src = pkgs.fetchzip {
357 url = "https://github.com/uthar/ltk/archive/f19162e76d6c7c2f51bd289b811d9ba20dd6555e.tar.gz";
358 sha256 = "0mzikv4abq9yqlj6dsji1wh34mjizr5prv6mvzzj29z1485fh1bj";
359 };
360 version = "f19162e76";
361 });
362
363
364 qt = let
365 rev = "dffff3ee3dbd0686c85c323f579b8bbf4881e60e";
366 in build-with-compile-into-pwd rec {
367 pname = "commonqt";
368 version = builtins.substring 0 7 rev;
369 src = pkgs.fetchFromGitHub {
370 inherit rev;
371 owner = pname;
372 repo = pname;
373 hash = "sha256-GAgwT0D9mIkYPTHfCH/KxxIv7b6QGwcxwZE7ehH5xug=";
374 };
375
376 buildInputs = [ pkgs.qt4 ];
377 nativeBuildInputs = [ pkgs.smokegen pkgs.smokeqt ];
378 nativeLibs = [ pkgs.qt4 pkgs.smokegen pkgs.smokeqt ];
379
380 systems = [ "qt" ];
381
382 lispLibs = with super; [
383 cffi named-readtables cl-ppcre alexandria
384 closer-mop iterate trivial-garbage bordeaux-threads
385 ];
386 };
387
388 qt-libs = build-with-compile-into-pwd {
389 inherit (super.qt-libs) pname version src;
390 patches = [ ./patches/qt-libs-dont-download.patch ];
391 prePatch = ''
392 substituteInPlace systems/*.asd --replace ":qt+libs" ":qt"
393 '';
394 lispLibs = super.qt-libs.lispLibs ++ [ self.qt ];
395 systems = [
396 "qt-libs"
397 "commonqt"
398 # "phonon"
399 # "qimageblitz"
400 # "qsci"
401 "qt3support"
402 "qtcore"
403 "qtdbus"
404 "qtdeclarative"
405 "qtgui"
406 "qthelp"
407 "qtnetwork"
408 "qtopengl"
409 "qtscript"
410 "qtsql"
411 "qtsvg"
412 "qttest"
413 "qtuitools"
414 # "qtwebkit"
415 "qtxml"
416 "qtxmlpatterns"
417 # "qwt"
418 "smokebase"
419 ];
420 };
421
422 commonqt = self.qt-libs;
423 qt3support = self.qt-libs;
424 qtcore = self.qt-libs;
425 qtdbus = self.qt-libs;
426 qtdeclarative = self.qt-libs;
427 qtgui = self.qt-libs;
428 qthelp = self.qt-libs;
429 qtnetwork = self.qt-libs;
430 qtopengl = self.qt-libs;
431 qtscript = self.qt-libs;
432 qtsql = self.qt-libs;
433 qtsvg = self.qt-libs;
434 qttest = self.qt-libs;
435 qtuitools = self.qt-libs;
436 qtxml = self.qt-libs;
437 qtxmlpatterns = self.qt-libs;
438 smokebase = self.qt-libs;
439
440 qtools = build-with-compile-into-pwd {
441 inherit (super.qtools) pname version src nativeLibs;
442 lispLibs = [ self.qt ] ++ remove super.qt_plus_libs super.qtools.lispLibs ++ [ self.qt-libs ];
443 patches = [ ./patches/qtools-use-nix-libs.patch ];
444 };
445
446 magicl = build-with-compile-into-pwd {
447 inherit (super.magicl) pname version src lispLibs;
448 nativeBuildInputs = [ pkgs.gfortran ];
449 nativeLibs = [ pkgs.openblas ];
450 patches = [ ./patches/magicl-dont-build-fortran-twice.patch ];
451 };
452
453 cl-glib = build-asdf-system {
454 pname = "cl-glib";
455 version = "1.0.0";
456 src = pkgs.fetchFromGitHub {
457 owner = "bohonghuang";
458 repo = "cl-glib";
459 rev = "84b128192d6b11cf03f1150e474a23368f07edff";
460 hash = "sha256-A56Yz+W4n1rAxxZg15zfkrLMbKMEG/zsWqaX7+kx4Qg=";
461 };
462 lispLibs = with super; [
463 cl-gobject-introspection-wrapper
464 bordeaux-threads
465 ];
466 };
467
468 cl-glib_dot_gio = build-asdf-system {
469 pname = "cl-glib.gio";
470 version = "1.0.0";
471 src = pkgs.fetchFromGitHub {
472 owner = "bohonghuang";
473 repo = "cl-glib";
474 rev = "84b128192d6b11cf03f1150e474a23368f07edff";
475 hash = "sha256-A56Yz+W4n1rAxxZg15zfkrLMbKMEG/zsWqaX7+kx4Qg=";
476 };
477 lispLibs = with super; [
478 cl-gobject-introspection-wrapper
479 ];
480 };
481
482 cl-gtk4 = build-asdf-system {
483 pname = "cl-gtk4";
484 version = "1.0.0";
485 src = pkgs.fetchFromGitHub {
486 owner = "bohonghuang";
487 repo = "cl-gtk4";
488 rev = "e18f621b996fd986d9829d590203c690440dee64";
489 hash = "sha256-++qydw6db4O3m+DAjutVPN8IuePOxseo9vhWEvwiR6E=";
490 };
491 lispLibs = with super; [
492 cl-gobject-introspection-wrapper
493 ] ++ [ self.cl-glib self.cl-glib_dot_gio ];
494 nativeBuildInputs = [
495 pkgs.gobject-introspection
496 pkgs.gtk4
497 ];
498 nativeLibs = [
499 pkgs.gtk4
500 ];
501 };
502
503 cl-gtk4_dot_adw = build-asdf-system {
504 pname = "cl-gtk4.adw";
505 version = "1.0.0";
506 src = pkgs.fetchFromGitHub {
507 owner = "bohonghuang";
508 repo = "cl-gtk4";
509 rev = "e18f621b996fd986d9829d590203c690440dee64";
510 hash = "sha256-++qydw6db4O3m+DAjutVPN8IuePOxseo9vhWEvwiR6E=";
511 };
512 lispLibs = with super; [
513 cl-gobject-introspection-wrapper
514 ] ++ [ self.cl-gtk4 ];
515 nativeBuildInputs = [
516 pkgs.libadwaita
517 ];
518 nativeLibs = [
519 pkgs.libadwaita
520 ];
521 };
522
523 cl-gtk4_dot_webkit2 = build-asdf-system {
524 pname = "cl-gtk4.webkit2";
525 version = "1.0.0";
526 src = pkgs.fetchFromGitHub {
527 owner = "bohonghuang";
528 repo = "cl-gtk4";
529 rev = "e18f621b996fd986d9829d590203c690440dee64";
530 hash = "sha256-++qydw6db4O3m+DAjutVPN8IuePOxseo9vhWEvwiR6E=";
531 };
532 lispLibs = with super; [
533 cl-gobject-introspection-wrapper
534 ] ++ [ self.cl-gtk4 ];
535 nativeBuildInputs = [
536 pkgs.webkitgtk_6_0
537 ];
538 nativeLibs = [
539 pkgs.webkitgtk_6_0
540 ];
541 };
542
543 cl-avro = build-asdf-system {
544 pname = "cl-avro";
545 version = "trunk";
546 src = pkgs.fetchFromGitHub {
547 owner = "SahilKang";
548 repo = "cl-avro";
549 rev = "7d624253e98afb987a01729bd72c99bae02f0d7d";
550 hash = "sha256-AlTn+Q1gKnAFEfcnz9+VeHz681pPIirg2za3VXYiNWk=";
551 };
552 lispLibs = with super; [
553 alexandria
554 babel
555 chipz
556 closer-mop
557 ieee-floats
558 flexi-streams
559 local-time
560 local-time-duration
561 md5
562 salza2
563 st-json
564 time-interval
565 trivial-extensible-sequences
566 ];
567 };
568
569 duckdb = build-asdf-system {
570 pname = "duckdb";
571 version = "trunk";
572 src = pkgs.fetchFromGitHub {
573 owner = "ak-coram";
574 repo = "cl-duckdb";
575 rev = "2f0df62f59fbede0addd8d72cf286f4007818a3e";
576 hash = "sha256-+jeOuXtCFZwMvF0XvlRaqTNHIAAFKMx6y1pz6u8Wxug=";
577 };
578 systems = [ "duckdb" "duckdb/test" "duckdb/benchmark" ];
579 lispLibs = with super; [
580 bordeaux-threads
581 cffi-libffi
582 cl-ascii-table
583 cl-spark
584 fiveam
585 local-time
586 local-time-duration
587 periods
588 trivial-benchmark
589 serapeum
590 str
591 uuid
592 ];
593 nativeLibs = with pkgs; [
594 duckdb libffi
595 ];
596 };
597
598 polyclot = build-asdf-system {
599 pname = "polyclot";
600 version = "trunk";
601 src = pkgs.fetchfossil {
602 url = "https://fossil.turtleware.eu/polyclot";
603 rev = "e678b3c3e002f53b446780406c9ed13f8451309d22a1dc50ced4dbeedf08a1ec";
604 sha256 = "sha256-J08bU9HSVbzEivYtQsyIYPZJTrugj+jJSa4LglS0Olg=";
605 };
606 systems = [ "eu.turtleware.polyclot" "eu.turtleware.polyclot/demo" ];
607 lispLibs = with super; [ clim mcclim mcclim-layouts ];
608 };
609
610 kons-9 = build-asdf-system rec {
611 pname = "kons-9";
612 version = "trunk";
613 src = pkgs.fetchFromGitHub {
614 owner = "kaveh808";
615 repo = "kons-9";
616 rev = "95ad44fac0566f445c4b7bd040339dcff75ee992";
617 sha256 = "19rl7372j9f1cv2kl55r8vyf4dhcz4way4hkjgysbxzrb1psp17n";
618 };
619 systems = [ "kons-9" "kons-9/testsuite" ];
620 lispLibs = with super; [
621 closer-mop trivial-main-thread trivial-backtrace cffi cl-opengl cl-glu
622 cl-glfw3 cl-paths-ttf zpb-ttf cl-vectors origin clobber
623 org_dot_melusina_dot_confidence
624 ];
625 };
626
627 });
628
629in packages