From c8f521e96a2d2b127ad4e6b6785b25f906c01ddf Mon Sep 17 00:00:00 2001 From: sterni Date: Tue, 27 Jul 2021 21:48:11 +0200 Subject: 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 Reviewed-by: grfn --- nix/buildLisp/default.nix | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'nix/buildLisp') diff --git a/nix/buildLisp/default.nix b/nix/buildLisp/default.nix index fe43c895f416..3e503a96a256 100644 --- a/nix/buildLisp/default.nix +++ b/nix/buildLisp/default.nix @@ -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. -- cgit 1.4.1