Skip to content

Commit

Permalink
Merge branch 'clisp'
Browse files Browse the repository at this point in the history
  • Loading branch information
hraban committed Oct 16, 2023
2 parents 937a1d3 + 264c9db commit df83028
Show file tree
Hide file tree
Showing 9 changed files with 84 additions and 21 deletions.
3 changes: 2 additions & 1 deletion examples/channels/all-packages-wrapped/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
cl-nix-lite ? ../../..
, pkgs ? import <nixpkgs> { overlays = [ (import cl-nix-lite) ]; }
, lisp ? (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}")
}:

with pkgs.lib;
with rec {
lispPackagesLite = pkgs.lispPackagesLiteFor (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}");
lispPackagesLite = pkgs.lispPackagesLiteFor lisp;
isSafeLisp = d: let
ev = builtins.tryEval (isDerivation d && !(d.meta.broken or false));
in ev.success && ev.value;
Expand Down
4 changes: 2 additions & 2 deletions examples/channels/all-packages/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
cl-nix-lite ? ../../..
, pkgs ? import <nixpkgs> { overlays = [ (import cl-nix-lite) ]; }
, lisp ? (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}")
}:

with pkgs.lib;
with rec {
# Compiling Shinmera/3d-math requires a lot of memory, might as well grant it
lispPackagesLite = pkgs.lispPackagesLiteFor (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}");
lispPackagesLite = pkgs.lispPackagesLiteFor lisp;
isSafeLisp = d: let
ev = builtins.tryEval (isDerivation d && !(d.meta.broken or false));
in ev.success && ev.value;
Expand Down
3 changes: 2 additions & 1 deletion examples/channels/hello-binary/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
cl-nix-lite ? ../../..
, pkgs ? import <nixpkgs> { overlays = [ (import cl-nix-lite) ]; }
, lisp ? pkgs.sbcl
}:

with pkgs.lispPackagesLite;
with pkgs.lispPackagesLiteFor lisp;

lispDerivation {
lispSystem = "hello-binary";
Expand Down
3 changes: 2 additions & 1 deletion examples/channels/override-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
{
cl-nix-lite ? ../../..
, pkgs ? import <nixpkgs> {}
, lisp ? (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}")
}:

let
Expand All @@ -22,7 +23,7 @@ let
(import cl-nix-lite)
# Now override alexandria in it
(final: prev: {
lispPackagesLite = prev.lispPackagesLite.overrideScope' (lfinal: lprev: {
lispPackagesLite = (prev.lispPackagesLiteFor lisp).overrideScope' (lfinal: lprev: {
# And because I’m only overriding the source, not any build
# instructions, I’m just overriding the existing derivation. But here of
# course you could also set this to an entirely custom lispDerivation
Expand Down
8 changes: 7 additions & 1 deletion examples/channels/test-all/default.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
cl-nix-lite ? ../../..
, pkgs ? import <nixpkgs> { overlays = [ (import cl-nix-lite) ]; }
, lisp ? (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}")
, skip ? [
"40ants-doc"
"40ants-doc-full" # this one works in QL so it’s nix specific
Expand Down Expand Up @@ -48,14 +49,19 @@
"lparallel"
] ++ pkgs.lib.optionals pkgs.hostPlatform.isLinux [
"usocket"
] ++ pkgs.lib.optionals (lisp.pname or "" == "clisp") [
"float-features" # *** - APPLY: too few arguments given to FIND
"fset" # https://github.com/slburson/fset/issues/42
"kmrcl" # odd floating point error on clisp
"trivial-custom-debugger" # *** - Condition of type TRIVIAL-CUSTOM-DEBUGGER/TEST::MY-ERROR.
]
}:

with pkgs.lib;
with rec {
# The tests for Shinmera/3d-math require a lot of memory, might as well grant
# it
lispPackagesLite = pkgs.lispPackagesLiteFor (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}");
lispPackagesLite = pkgs.lispPackagesLiteFor lisp;
isSafeLisp = d: let
ev = builtins.tryEval (isDerivation d && !(d.meta.broken or false));
in ev.success && ev.value;
Expand Down
3 changes: 2 additions & 1 deletion examples/channels/with-cffi/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
cl-nix-lite ? ../../..
, pkgs ? import <nixpkgs> { overlays = [ (import cl-nix-lite) ]; }
, lisp ? (f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}")
}:

with pkgs.lispPackagesLite;
with pkgs.lispPackagesLiteFor lisp;

lispDerivation {
lispDependencies = [ alexandria arrow-macros cl-async cl-async-ssl ];
Expand Down
39 changes: 27 additions & 12 deletions examples/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,55 @@

{
cl-nix-lite ? ../.
, pkgs ? import <nixpkgs> { overlays = [ (import cl-nix-lite) ]; }
, lisp ? pkgs.sbcl
, pkgs ? import <nixpkgs> { }
}:

with pkgs.lib;

let
inherit (pkgs.lib) isDerivation;
pkgs' = import (pkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "9fd11c68d731289f86938c168065c8675c674089";
hash = "sha256-19sco110ACPniXK7PSyIKGLhKbcloONovDzF1dkg5xM";
}) {
overlays = [ (import cl-nix-lite) ];
};
sbcl = f: "${pkgs.sbcl}/bin/sbcl --dynamic-space-size 4000 --script ${f}";
lisps = [ sbcl pkgs'.clisp ];
# Massage a test input into a list of derivations (for later flattening)
all-inputs = input:
if builtins.isPath input
then all-inputs (pkgs.callPackage input { })
else if isDerivation input
allInputs = input:
if isDerivation input
then [ input ]
else
assert pkgs.lib.isAttrs input;
assert isAttrs input;
builtins.filter isDerivation (builtins.attrValues input);
# Simple paths which can just be imported directly
channel-based-tests = builtins.map all-inputs [
channelTestPaths = lisp: [
./channels/all-packages
./channels/all-packages-wrapped
./channels/hello-binary
./channels/override-package
./channels/test-all
] ++ optionals (lisp.pname or "" != "clisp") [
./channels/with-cffi
];
channelTestsFor = lisp:
map
(p: allInputs (pkgs'.callPackage p { inherit lisp; }))
(channelTestPaths lisp);
channelTests = map channelTestsFor lisps;

# These need some more work
flake-tests = [
flakeTests = [
./flakes/make-binary
./flakes/override-input
];
flake-to-deriv = f: (builtins.getFlake (builtins.toString f)).packages.${builtins.currentSystem}.default;
flakeToDeriv = f: (builtins.getFlake (builtins.toString f)).packages.${builtins.currentSystem}.default;
in
# Outputting a list of all derivations (instead of e.g. a mock wrapper
# derivation) allows me to later filter this down to only derivations that need
# to be /built/, on CI. That allows you to exclude anything that already exists
# on cache. This is useful because otherwise it will redownload everything, just
# to throw it away immediately again.
pkgs.lib.lists.flatten (channel-based-tests ++ (map flake-to-deriv flake-tests))
flatten channelTests ++ (map flakeToDeriv flakeTests)
1 change: 1 addition & 0 deletions lisp-derivation.nix
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ let
assert isDerivation lisp;
{
sbcl = file: ''"${lisp}/bin/sbcl" --script "${file}"'';
clisp = file: ''"${lisp}/bin/clisp" -E UTF-8 -norc "${file}"'';
ecl = file: ''"${lisp}/bin/ecl" --shell "${file}"'';
}.${lisp.pname};

Expand Down
41 changes: 39 additions & 2 deletions lisp-packages-lite.nix
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ rec {
lispSystem = name; # convention
src = inputs.${name};
};
lispName = (lisp.pname or "");
in {
inherit lispDerivation lispMultiDerivation lispWithSystems;

Expand All @@ -58,6 +59,8 @@ rec {
lispCheckDependencies = [ parachute ];
src = inputs."3d-math";
lispSystem = "3d-math";
# Compiling this on CLISP hangs forever.
meta.broken = lispName == "clisp";
};

"3d-vectors" = lispDerivation {
Expand Down Expand Up @@ -161,6 +164,8 @@ rec {
lispDependencies = [ arnesi swank ];
};
};
# #<PACKAGE CHARSET> has no external symbol with name "UTF-16"
meta.broken = lispName == "clisp";
}) arnesi arnesi-cl-ppcre-extras arnesi-slime-extras;

array-utils = lispDerivation {
Expand Down Expand Up @@ -198,6 +203,8 @@ rec {
src = inputs.atomics;
lispDependencies = [ documentation-utils ];
lispCheckDependencies = [ parachute ];
# CLISP is not supported by the Atomics library.
meta.broken = lispName == "clisp";
};

inherit (lispMultiDerivation {
Expand Down Expand Up @@ -233,6 +240,7 @@ rec {
buildInputs = [ pkgs.libuv ];
lispSystem = "bordeaux-threads";
src = inputs.bordeaux-threads;
meta.broken = lispName == "clisp";
};

inherit (lispMultiDerivation rec {
Expand Down Expand Up @@ -279,6 +287,11 @@ rec {
(builtins.readFile ./cffi-setup-hook.sh ))
else ./cffi-setup-hook.sh
)];
# CFFI requires CLISP compiled with dynamic FFI support, which only
# enabled on Linux
meta = systems: a.optionalAttrs (b.elem "cffi" systems) {
broken = ! (lispName == "clisp" -> pkgs.stdenv.isLinux);
};
}) cffi cffi-grovel;

calispel = lispDerivation {
Expand Down Expand Up @@ -791,6 +804,8 @@ rec {
];
};
};
# *** - The function get-structure is not yet implemented for CLISP 2.49.92
meta.broken = lispName == "clisp";
}) cl-variates "cl-variates/with-metacopy";

cl-who = lispDerivation {
Expand Down Expand Up @@ -994,7 +1009,7 @@ rec {
dissect = lispDerivation {
lispSystem = "dissect";
src = inputs.dissect;
lispDependencies = l.optional ((lisp.pname or "") == "clisp") cl-ppcre;
lispDependencies = l.optional (lispName == "clisp") cl-ppcre;
};

djula = lispDerivation {
Expand Down Expand Up @@ -1262,6 +1277,8 @@ rec {
src = inputs.history-tree;
lispCheckDependencies = [ lisp-unit2 ];
lispSystem = "history-tree";
# *** - EVAL: undefined function EXT::ADD-PACKAGE-LOCAL-NICKNAME
meta.broken = lispName == "clisp";
};

http-body = lispDerivation {
Expand Down Expand Up @@ -1531,6 +1548,10 @@ rec {
lispSystems = [ "lass" "binary-lass" ];
lispDependencies = [ trivial-indent trivial-mimes cl-base64 ];
src = inputs.lass;
# This is kind of ridiculous, but there’s a file here called asdf.lisp
# which trips up clisp: ‘(require :asdf)’ loads that file, rather than
# actual asdf. Who’s at fault here?
meta.broken = lispName == "clisp";
};

legion = lispDerivation {
Expand All @@ -1552,7 +1573,17 @@ rec {
src = inputs.let-plus;
};

lift = lispify "lift" [ ];
lift = lispDerivation {
lispSystem = "lift";
src = inputs.lift;
# There is a bug in lift which causes some silly pathname, ‘mkdir -p’
# style problem. Setting the broken flag here is the easiest way to
# disable all lift tests on clisp for now. The bug looks like this:
#
# > *** - PROBE-FILE: No file name given:
# > #P"/private/tmp/nix-build-system-metatilities-base.drv-1/source/test-results-2023-10-16-1/
meta.broken = lispName == "clisp";
};

lisp-namespace = lispDerivation {
lispSystem = "lisp-namespace";
Expand Down Expand Up @@ -2081,6 +2112,7 @@ rec {
src = inputs.static-vectors;
lispDependencies = [ alexandria cffi cffi-grovel ];
lispCheckDependencies = [ fiveam ];
meta.broken = lispName == "clisp";
};

stefil = lispify "stefil" [
Expand Down Expand Up @@ -2318,6 +2350,7 @@ rec {
preCheck = ''
export CL_SOURCE_REGISTRY="$PWD/code/test-suite:$CL_SOURCE_REGISTRY"
'';
meta.broken = lispName == "clisp";
};

unit-test = lispify "unit-test" [ ];
Expand Down Expand Up @@ -2350,6 +2383,10 @@ rec {
lispCheckDependencies = [ fiveam ];
lispSystem = "wild-package-inferred-system";
src = inputs.wild-package-inferred-system;
# Clisp packages ASDF v3.2, WPI requires ≥3.3, this is the easiest way to
# remedy that. Of course you can byo-ASDF, at which point you can just
# .overrideAttrs this flag back to false.
meta.broken = lispName == "clisp";
};

with-output-to-stream = lispDerivation {
Expand Down

0 comments on commit df83028

Please sign in to comment.