summaryrefslogtreecommitdiffstats
path: root/pkgs/development/lisp-modules/packages.nix
blob: 783215a74c4ae11c27f0184578d335c454ba7c28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
{
  build-asdf-system,
  spec,
  quicklispPackagesFor,
  stdenv,
  pkgs,
  ...
}:

let

  inherit (pkgs.lib)
    head
    makeLibraryPath
    makeSearchPath
    setAttr
    hasAttr
    optionals
    optionalAttrs
    isDerivation
    hasSuffix
    splitString
    remove
    ;

  # Used by builds that would otherwise attempt to write into storeDir.
  #
  # Will run build two times, keeping all files created during the
  # first run, exept the FASL's. Then using that directory tree as the
  # source of the second run.
  #
  # E.g. cl-unicode creating .txt files during compilation
  build-with-compile-into-pwd =
    args:
    let
      args' = if isDerivation args then args.drvAttrs else args;
      build = (build-asdf-system (args' // { version = args'.version + "-build"; })).overrideAttrs (o: {
        buildPhase = with builtins; ''
          runHook preBuild

          mkdir __fasls
          export ASDF_OUTPUT_TRANSLATIONS="$(pwd):$(pwd)/__fasls:${storeDir}:${storeDir}"
          export CL_SOURCE_REGISTRY=$CL_SOURCE_REGISTRY:$(pwd)//
          ${o.pkg}/bin/${o.program} ${toString (o.flags or [ ])} < ${o.buildScript}

          runHook postBuild
        '';
        installPhase = ''
          runHook preInstall

          mkdir -pv $out
          rm -rf __fasls
          cp -r * $out

          runHook postInstall
        '';
      });
    in
    build-asdf-system (
      args'
      // {
        # Patches are already applied in `build`
        patches = [ ];
        postPatch = "";
        src = build;
      }
    );

  # Makes it so packages imported from Quicklisp can be re-used as
  # lispLibs ofpackages in this file.
  ql = quicklispPackagesFor spec;

  packages = ql.overrideScope (
    self: super:
    {

      cl-unicode = build-with-compile-into-pwd {
        inherit (super.cl-unicode)
          pname
          version
          src
          systems
          ;
        lispLibs = super.cl-unicode.lispLibs ++ [ self.flexi-streams ];
      };

      jzon = super.com_dot_inuoe_dot_jzon;

      _40ants-routes = super._40ants-routes.overrideLispAttrs (o: {
        systems = o.systems ++ [ "40ants-routes/handler" ];
      });

      reblocks-ui2 = super.reblocks-ui2.overrideLispAttrs (o: {
        systems = o.systems ++ [
          "reblocks-ui2/themes/color"
          "reblocks-ui2/themes/tailwind"
          "reblocks-ui2/utils/padding"
          "reblocks-ui2/utils/align"
          "reblocks-ui2/card"
          "reblocks-ui2/card/view"
        ];
      });

      april = super.april.overrideLispAttrs (o: {
        systems = o.systems ++ [ "cape" ];
      });

      cl-notify = build-asdf-system {
        pname = "cl-notify";
        version = "20080904-138ca7038";
        src = pkgs.fetchzip {
          url = "https://repo.or.cz/cl-notify.git/snapshot/138ca703861f4a1fbccbed557f92cf4d213668a1.tar.gz";
          sha256 = "0k6ns6fzvjcbpsqgx85r4g5m25fvrdw9481i9vyabwym9q8bbqwx";
        };
        lispLibs = [
          self.cffi
        ];
        nativeLibs = [
          pkgs.libnotify
        ];
      };

      cl-liballegro-nuklear = build-with-compile-into-pwd super.cl-liballegro-nuklear;

      cl-project = super.cl-project.overrideLispAttrs {
        # install skeleton.asd
        postInstall = ''
          cp -v skeleton/skeleton.asd $out/skeleton
        '';
      };

      lessp = build-asdf-system {
        pname = "lessp";
        version = "0.2-f8a9e4664";
        src = pkgs.fetchzip {
          url = "https://github.com/facts-db/cl-lessp/archive/632217602b85b679e8d420654a0aa39e798ca3b5.tar.gz";
          sha256 = "0i3ia14dzqwjpygd0zn785ff5vqnnmkn75psfpyx0ni3jr71lkq9";
        };
      };

      rollback = build-asdf-system {
        pname = "rollback";
        version = "0.1-5d3f21fda";
        src = pkgs.fetchzip {
          url = "https://github.com/facts-db/cl-rollback/archive/5d3f21fda8f04f35c5e9d20ee3b87db767915d15.tar.gz";
          sha256 = "12dpxsbm2al633y87i8p784k2dn4bbskz6sl40v9f5ljjmjqjzxf";
        };
      };

      facts = build-asdf-system {
        pname = "facts";
        version = "0.1-632217602";
        src = pkgs.fetchzip {
          url = "https://beta.quicklisp.org/archive/cl-facts/2022-11-06/cl-facts-20221106-git.tgz";
          sha256 = "sha256-PBpyyJYkq1NjKK9VikSAL4TmrGRwUJlEWRSeKj/f4Sc=";
        };
        lispLibs = [
          self.lessp
          self.rollback
          self.local-time
        ];
      };

      cl-fuse = build-with-compile-into-pwd {
        inherit (super.cl-fuse)
          pname
          version
          src
          lispLibs
          ;
        nativeBuildInputs = [ pkgs.fuse ];
        nativeLibs = [ pkgs.fuse ];
      };

      cl-containers = build-asdf-system {
        inherit (super.cl-containers) pname version src;
        lispLibs = super.cl-containers.lispLibs ++ [ self.moptilities ];
        systems = [
          "cl-containers"
          "cl-containers/with-moptilities"
        ];
      };

      swank = build-with-compile-into-pwd rec {
        inherit (super.swank) pname lispLibs;
        version = "2.29.1";
        src = pkgs.fetchFromGitHub {
          owner = "slime";
          repo = "slime";
          rev = "v${version}";
          hash = "sha256-5hNB5XxbTER4HX3dn4umUGnw6UeiTQkczmggFz4uWoE=";
        };
        systems = [
          "swank"
          "swank/exts"
        ];
        patches = [ ./patches/swank-pure-paths.patch ];
        postConfigure = ''
          substituteAllInPlace swank-loader.lisp
        '';
      };

      slynk = build-asdf-system {
        pname = "slynk";
        version = "trunk";
        src = pkgs.fetchFromGitHub {
          owner = "joaotavora";
          repo = "sly";
          rev = "ba40c8f054ec3b7040a6c36a1ef3e9596b936421";
          hash = "sha256-hoaCZtyezuXptDPnAvBTT0SZ14M9Ifrmki3beBOwFmI=";
        };
        systems = [
          "slynk"
          "slynk/arglists"
          "slynk/fancy-inspector"
          "slynk/package-fu"
          "slynk/mrepl"
          "slynk/trace-dialog"
          "slynk/profiler"
          "slynk/stickers"
          "slynk/indentation"
          "slynk/retro"
        ];
        meta = {
          homepage = "https://github.com/joaotavora/sly";
        };
      };

      cephes = build-with-compile-into-pwd {
        inherit (super.cephes)
          pname
          version
          src
          lispLibs
          ;
        patches = [ ./patches/cephes-make.patch ];
        postPatch = ''
          find \( -name '*.dll' -o -name '*.dylib' -o -name '*.so' \) -delete
        '';
        postConfigure = ''
          substituteAllInPlace cephes.asd
        '';
        postInstall = ''
          find $out -name '*.o' -delete
        '';
      };

      clx-truetype = build-asdf-system {
        pname = "clx-truetype";
        version = "20160825-git";
        src = pkgs.fetchzip {
          url = "https://beta.quicklisp.org/archive/clx-truetype/2016-08-25/clx-truetype-20160825-git.tgz";
          sha256 = "079hyp92cjkdfn6bhkxsrwnibiqbz4y4af6nl31lzw6nm91j5j37";
        };
        lispLibs = with self; [
          alexandria
          bordeaux-threads
          cl-aa
          cl-fad
          cl-paths
          cl-paths-ttf
          cl-store
          cl-vectors
          clx
          trivial-features
          zpb-ttf
        ];
      };

      mathkit = build-asdf-system {
        inherit (super.mathkit)
          pname
          version
          src
          asds
          ;
        lispLibs = super.mathkit.lispLibs ++ [ super.sb-cga ];
      };

      stumpwm = super.stumpwm.overrideLispAttrs {
        inherit (pkgs.stumpwm) src version;
        meta = {
          inherit (pkgs.stumpwm.meta) description license homepage;
        };
      };

      clfswm = super.clfswm.overrideAttrs (o: {
        buildScript = pkgs.writeText "build-clfswm.lisp" ''
          (load "${o.asdfFasl}/asdf.${o.faslExt}")
          (asdf:load-system 'clfswm)
          (sb-ext:save-lisp-and-die
            "clfswm"
            :executable t
            #+sb-core-compression :compression
            #+sb-core-compression t
            :toplevel #'clfswm:main)
        '';
        installPhase = o.installPhase + ''
          mkdir -p $out/bin
          mv $out/clfswm $out/bin
        '';
      });

      magicl = build-with-compile-into-pwd {
        inherit (super.magicl)
          pname
          version
          src
          lispLibs
          ;
        nativeBuildInputs = [ pkgs.gfortran ];
        nativeLibs = [ pkgs.openblas ];
      };

      cl-gtk4 = build-asdf-system {
        pname = "cl-gtk4";
        version = "1.0.0";
        src = pkgs.fetchFromGitHub {
          owner = "bohonghuang";
          repo = "cl-gtk4";
          rev = "b3e69daf2f96e69881b053046bbe8544a54e087f";
          hash = "sha256-9bRxxc3LtDR7gE0jorsrguRYaIq2InVOys27W7Im050=";
        };
        lispLibs = with self; [
          cl-gobject-introspection-wrapper
          cl-glib
          cl-gio
          cl-gobject
        ];
        nativeBuildInputs = [
          pkgs.gobject-introspection
          pkgs.gtk4
        ];
        nativeLibs = [
          pkgs.gtk4
        ];
        meta = {
          homepage = "https://github.com/bohonghuang/cl-gtk4";
        };
      };

      cl-gtk4_dot_adw = build-asdf-system {
        pname = "cl-gtk4.adw";
        version = self.cl-gtk4.version;
        src = self.cl-gtk4.src;
        lispLibs = with self; [
          cl-gobject-introspection-wrapper
          cl-gtk4
        ];
        nativeBuildInputs = [
          pkgs.libadwaita
        ];
        nativeLibs = [
          pkgs.libadwaita
        ];
        meta = {
          homepage = "https://github.com/bohonghuang/cl-gtk4";
        };
      };

      cl-gtk4_dot_webkit = build-asdf-system {
        pname = "cl-gtk4.webkit";
        version = self.cl-gtk4.version;
        src = self.cl-gtk4.src;
        lispLibs = with self; [
          cl-gobject-introspection-wrapper
          cl-gtk4
        ];
        nativeBuildInputs = [
          pkgs.webkitgtk_6_0
        ];
        nativeLibs = [
          pkgs.webkitgtk_6_0
        ];
        meta = {
          homepage = "https://github.com/bohonghuang/cl-gtk4";
        };
      };

      cl-gtk4_dot_sourceview = build-asdf-system {
        pname = "cl-gtk4.sourceview";
        version = self.cl-gtk4.version;
        src = self.cl-gtk4.src;
        lispLibs = with self; [
          cl-gobject-introspection-wrapper
          cl-gtk4
        ];
        nativeBuildInputs = [
          pkgs.gtksourceview5
        ];
        nativeLibs = [
          pkgs.gtksourceview5
        ];
        meta = {
          homepage = "https://github.com/bohonghuang/cl-gtk4";
        };
      };

      cl-gdk4 = build-asdf-system {
        pname = "cl-gdk4";
        version = self.cl-gtk4.version;
        src = self.cl-gtk4.src;
        lispLibs = with self; [
          cl-gobject-introspection-wrapper
        ];
        nativeBuildInputs = [
          pkgs.gobject-introspection
          pkgs.gtk4
        ];
        nativeLibs = [
          pkgs.gtk4
        ];
        meta = {
          homepage = "https://github.com/bohonghuang/cl-gtk4";
        };
      };

      cl-avro = build-asdf-system {
        pname = "cl-avro";
        version = "trunk";
        src = pkgs.fetchFromGitHub {
          owner = "SahilKang";
          repo = "cl-avro";
          rev = "b8fa26320fa0ae88390215140d57f9cca937f691";
          hash = "sha256-acXsotvKWuffrLbrG9YJ8yZc5E6WC8N0qCFCAiX6N0Q=";
        };
        lispLibs = with self; [
          alexandria
          babel
          chipz
          closer-mop
          ieee-floats
          flexi-streams
          local-time
          local-time-duration
          md5
          salza2
          st-json
          time-interval
          trivial-extensible-sequences
        ];
        meta = {
          homepage = "https://github.com/SahilKang/cl-avro";
        };
      };

      frugal-uuid = super.frugal-uuid.overrideLispAttrs (o: {
        systems = [
          "frugal-uuid"
          "frugal-uuid/non-frugal"
          "frugal-uuid/test"
        ];
        lispLibs =
          o.lispLibs
          ++ (with self; [
            ironclad
            babel
            trivial-clock
            trivial-benchmark
            fiveam
          ]);
      });

      duckdb = super.duckdb.overrideLispAttrs (o: {
        systems = [
          "duckdb"
          "duckdb/test"
          "duckdb/benchmark"
        ];
      });

      polyclot = build-asdf-system {
        pname = "polyclot";
        version = "trunk";
        src = pkgs.fetchfossil {
          url = "https://fossil.turtleware.eu/fossil.turtleware.eu/polyclot";
          rev = "18500c968b1fc1e2a915b5c70b8cddc4a2b54de51da4eedc5454e42bfea3b479";
          sha256 = "sha256-KgBL1QQN4iG6d8E9GlKAuxSwkrY6Zy7e1ZzEDGKad+A=";
        };
        systems = [
          "eu.turtleware.polyclot"
          "eu.turtleware.polyclot/demo"
        ];
        lispLibs = with self; [
          clim
          mcclim
          mcclim-layouts
        ];
        meta = {
          homepage = "https://github.com/kaveh808/kons-9";
        };
      };

      kons-9 = build-asdf-system {
        pname = "kons-9";
        version = "trunk";
        src = pkgs.fetchFromGitHub {
          owner = "kaveh808";
          repo = "kons-9";
          rev = "08770e7fbb839b91fd035f1cd4a50ecc81b42d57";
          sha256 = "sha256-Tit/qmOU5+zp43/ecIXGbh4CtgWzltWM7tHdVWkga0k=";
        };
        systems = [
          "kons-9"
          "kons-9/testsuite"
        ];
        patches = [ ./patches/kons-9-fix-testsuite-compilation.patch ];
        lispLibs = with self; [
          closer-mop
          trivial-main-thread
          trivial-backtrace
          cffi
          cl-opengl
          cl-glu
          cl-glfw3
          cl-paths-ttf
          zpb-ttf
          cl-vectors
          origin
          clobber
          shasht
          org_dot_melusina_dot_confidence
        ];
        meta = {
          homepage = "https://github.com/kaveh808/kons-9";
        };
      };

      nsb-cga = super.nsb-cga.overrideLispAttrs (old: {
        lispLibs = old.lispLibs ++ [ self.sb-cga ];
      });

      qlot-cli = build-asdf-system rec {
        pname = "qlot";
        version = "1.5.2";

        src = pkgs.fetchFromGitHub {
          owner = "fukamachi";
          repo = "qlot";
          tag = version;
          hash = "sha256-j9iT25Yz9Z6llCKwwiHlVNKLqwuKvY194LrAzXuljsE=";
        };

        lispLibs = with self; [
          archive
          deflate
          dexador
          fuzzy-match
          ironclad
          lparallel
          yason
        ];

        nativeLibs = [
          pkgs.openssl
        ];

        nativeBuildInputs = [
          pkgs.makeWrapper
        ];

        buildScript = pkgs.writeText "build-qlot-cli" ''
          (load "${self.qlot-cli.asdfFasl}/asdf.${self.qlot-cli.faslExt}")
          (asdf:load-system :qlot/command)
          (asdf:load-system :qlot/subcommands)

          ;; Use uiop:dump-image instead of sb-ext:dump-image for the image restore hooks
          (setf uiop:*image-entry-point* #'qlot/cli:main)
          (uiop:dump-image "qlot"
                           :executable t
                           #+sb-core-compression :compression
                           #+sb-core-compression t)
        '';

        installPhase = ''
          runHook preInstall

          mkdir -p $out/bin
          cp qlot.asd $out
          rm *.asd
          cp -r * $out

          mv $out/qlot $out/bin
          wrapProgram $out/bin/qlot \
            --prefix LD_LIBRARY_PATH : $LD_LIBRARY_PATH

          runHook postInstall
        '';

        meta = {
          mainProgram = "qlot";
          homepage = "https://github.com/fukamachi/qlot";
        };
      };

      fset = super.fset.overrideLispAttrs (old: {
        systems = [
          "fset"
          "fset/test"
        ];
        meta = {
          description = "Functional collections library";
          homepage = "https://gitlab.common-lisp.net/fset/fset/-/wikis/home";
          license = with pkgs.lib.licenses; WITH lgpl21Only llgplPreamble;
        };
      });

      thih-coalton = self.coalton;
      quil-coalton = self.coalton;
      coalton = super.coalton.overrideLispAttrs (old: {
        systems = [
          "coalton"
          "thih-coalton"
          "quil-coalton"
          "thih-coalton/tests"
          "quil-coalton/tests"
          "coalton/tests"
        ];
        lispLibs = old.lispLibs ++ [ self.fiasco ];
        nativeLibs = [ pkgs.mpfr ];
        meta = {
          description = "Statically typed functional programming language that supercharges Common Lisp";
          homepage = "https://coalton-lang.github.io";
          license = pkgs.lib.licenses.mit;
        };
      });

      cffi-c2ffi = self.cffi.overrideLispAttrs (old: {
        systems = old.systems ++ [
          "cffi/c2ffi"
          "cffi/c2ffi-generator"
        ];
        lispLibs = old.lispLibs ++ [
          self.cl-ppcre
          self.cl-json
        ];
        postPatch = (old.postPatch or "") + ''
          echo '(unless (ignore-errors (c2ffi-executable-available?))
              (setf *c2ffi-executable* "${pkgs.lib.getExe pkgs.c2ffi}"))' \
          >> src/c2ffi/c2ffi.lisp
        '';
      });
    }
    // optionalAttrs pkgs.config.allowAliases {
      cl-glib_dot_gio = throw "cl-glib_dot_gio was replaced by cl-gio";
      cl-gtk4_dot_webkit2 = throw "cl-gtk4_dot_webkit2 was replaced by cl-gtk4_dot_webkit";
      stumpwm-unwrapped = throw "stumpwm-unwrapped is now just stumpwm";
    }
  );

in
packages