Skip to content

Commit 4f5bcff

Browse files
committed
build: use ECL (breaks noref!)
1 parent b139d60 commit 4f5bcff

File tree

2 files changed

+37
-18
lines changed

2 files changed

+37
-18
lines changed

flake.nix

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,14 @@
2929
};
3030

3131
outputs = { self, nixpkgs, flake-utils, cl-nix-lite, ... }: let
32-
git-hly = { sbcl, pkgs, lib }: let
33-
pkgs' = pkgs.extend cl-nix-lite.overlays.default;
32+
git-hly = { pkgs, lib }: let
33+
inherit (pkgs) ecl;
34+
pkgs' = pkgs.appendOverlays [
35+
cl-nix-lite.overlays.default
36+
(pfinal: pprev: {
37+
lispPackagesLite = pprev.lispPackagesLiteFor ecl;
38+
})
39+
];
3440
inherit (pkgs') lispPackagesLite;
3541
in with lispPackagesLite; lispDerivation {
3642
lispSystem = "git-hly";
@@ -45,19 +51,39 @@
4551
trivia
4652
lispPackagesLite."trivia.ppcre"
4753
];
54+
lispBuildPhase = ''
55+
;; ECL is not a fan of ASDFv3's auto update magic
56+
(load "${asdf}/build/asdf.lisp")
57+
(let ((sys "git-hly"))
58+
(asdf:load-system sys)
59+
(asdf:make-build sys
60+
:type :program
61+
:move-here #P"./bin/"
62+
:epilogue-code `(progn
63+
(,(read-from-string
64+
(asdf::component-entry-point
65+
(asdf:find-system sys))))
66+
(quit))))
67+
'';
4868
# Override this to to disable the per-child command symlinking
4969
symlinkCommands = true;
5070
# I’m not sure if this is genius or awful? If I have to ask, it’s
5171
# probably awful.
52-
postBuild = ''
72+
postBuild = let
73+
namePrinter = pkgs.writeText "print-names.lisp" ''
74+
(setf *compile-verbose* NIL)
75+
(setf *load-verbose* NIL)
76+
(load "${asdf}/build/asdf.lisp")
77+
(asdf:load-system "git-hly")
78+
(format T "~{~(~A~)~%~}" (git-hly/src/cmd::cmd-names))
79+
'';
80+
in ''
5381
# Ideally, I should be able to access overridden args in the derivation itself
5482
# by passing a callback to lispDerivation, just like stdenv.mkDerivation...
5583
if [[ $symlinkCommands == "1" ]]; then
56-
${sbcl}/bin/sbcl --script <<EOF | while read cmd ; do (cd bin && ln -s git-hly git-$cmd) ; done
57-
(require :asdf)
58-
(asdf:load-system "git-hly")
59-
(format T "~{~(~A~)~^~%~}~%" (git-hly/src/cmd::cmd-names))
60-
EOF
84+
${lib.getExe ecl} --shell ${namePrinter} | while read cmd ; do
85+
ln -s git-hly bin/git-$cmd
86+
done
6187
fi
6288
'';
6389
installPhase = "mkdir -p $out; cp -r bin $out/";
@@ -69,19 +95,10 @@ fi
6995
in flake-utils.lib.eachDefaultSystem (system:
7096
with rec {
7197
pkgs = nixpkgs.legacyPackages.${system};
72-
sbclNoRefs = pkgs.sbcl.overrideAttrs {
73-
bootstrapLisp = pkgs.lib.getExe pkgs.sbcl;
74-
purgeNixReferences = true;
75-
coreCompression = false;
76-
doCheck = false;
77-
};
7898
};
7999
{
80100
packages = {
81101
default = pkgs.callPackage git-hly { };
82-
norefs = (pkgs.extend (self: super: {
83-
sbcl = sbclNoRefs;
84-
})).callPackage git-hly {};
85102
};
86103
});
87104
}

git-hly.asd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@
2020
:build-operation "program-op"
2121
:build-pathname "bin/git-hly"
2222
:entry-point "git-hly:main"
23-
:depends-on ("git-hly/main"))
23+
;; ECL wants an explicit note that ASDF is required, and it must be first in
24+
;; the depends-on list (!)
25+
:depends-on ("asdf" "git-hly/main"))

0 commit comments

Comments
 (0)