refactor(nix/buildLisp): use passthru for extra attributes

Using passthru and appending the attributes via `//` have the same
effect with a subtle difference: In the latter case re-evaluating
the derivation when using the underlying `mkDerivation`'s
`overrideAttrs` will delete all appended attributes. Using
passthru at least preserves the attributes although the self
reference to the derivation in `passthru.sbcl` will become
outdated (unless updated manually).

Change-Id: I8b85009f386b9375b86a23fd50c4ec8c6a9dea7f
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3257
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: grfn <grfn@gws.fyi>
This commit is contained in:
sterni 2021-07-27 21:48:11 +02:00
parent 04ecf9cbbb
commit c8f521e96a

View file

@ -162,6 +162,13 @@ let
in lib.fix (self: runCommandNoCC "${name}-cllib" {
LD_LIBRARY_PATH = lib.makeLibraryPath lispNativeDeps;
LANG = "C.UTF-8";
passthru = {
inherit lispNativeDeps lispDeps;
lispName = name;
lispBinary = false;
tests = testDrv;
sbcl = sbclWith [ self ];
};
} ''
${if ! isNull testDrv
then "echo 'Test ${testDrv} succeeded'"
@ -176,13 +183,7 @@ let
chmod +x cat_fasls
./cat_fasls > $out/${name}.fasl
'' // {
inherit lispNativeDeps lispDeps;
lispName = name;
lispBinary = false;
tests = testDrv;
sbcl = sbclWith [ self ];
});
'');
# 'program' creates an executable containing a dumped image of the
# specified sources and dependencies.
@ -215,6 +216,14 @@ let
nativeBuildInputs = [ makeWrapper ];
LD_LIBRARY_PATH = libPath;
LANG = "C.UTF-8";
passthru = {
lispName = name;
lispDeps = [ selfLib ] ++ (tests.deps or []);
lispNativeDeps = native;
lispBinary = true;
tests = testDrv;
sbcl = sbclWith [ self ];
};
} ''
${if ! isNull testDrv
then "echo 'Test ${testDrv} succeeded'"
@ -226,14 +235,7 @@ let
}
wrapProgram $out/bin/${name} --prefix LD_LIBRARY_PATH : "${libPath}"
'' // {
lispName = name;
lispDeps = [ selfLib ] ++ (tests.deps or []);
lispNativeDeps = native;
lispBinary = true;
tests = testDrv;
sbcl = sbclWith [ self ];
});
'');
# 'bundled' creates a "library" that calls 'require' on a built-in
# package, such as any of SBCL's sb-* packages.