From d4a393e6c4e8f38d739d9feb98112fe6c8250a7f Mon Sep 17 00:00:00 2001 From: TANIGUCHI Masaya Date: Sat, 23 Nov 2024 08:15:46 +0900 Subject: [PATCH] fix(flake.nix): add workaround for nixpkgs issue Added a workaround for the issue described in https://github.com/NixOS/nixpkgs/pull/358036. Updated the flake.nix file to include necessary patches and changes to handle different Lisp implementations more effectively. --- flake.nix | 176 ++++++++++++++++++++++++++---------------------------- 1 file changed, 84 insertions(+), 92 deletions(-) diff --git a/flake.nix b/flake.nix index d65d81e..a9af0d6 100644 --- a/flake.nix +++ b/flake.nix @@ -5,6 +5,22 @@ flake-parts.url = "github:hercules-ci/flake-parts"; }; outputs = inputs @ { nixpkgs, flake-parts, ... }: + let + # This is a workaround for https://github.com/NixOS/nixpkgs/pull/358036 + patch = flake-parts.lib.mkFlake { inherit inputs; } { + imports = [ + flake-parts.flakeModules.easyOverlay + ]; + systems = nixpkgs.lib.platforms.all; + perSystem = { pkgs, ... }: { + overlayAttrs = { + ccl = pkgs.lib.recursiveUpdate pkgs.ccl { meta.mainProgram = "ccl"; }; + mkcl = pkgs.lib.recursiveUpdate pkgs.mkcl { meta.mainProgram = "mkcl"; }; + cmucl_binary = pkgs.lib.recursiveUpdate pkgs.cmucl_binary { meta.mainProgram = "lisp"; }; + }; + }; + }; + in flake-parts.lib.mkFlake { inherit inputs; } { imports = [ flake-parts.flakeModules.easyOverlay @@ -48,46 +64,40 @@ && (!lisp.meta.broken); availableLispImpls = builtins.filter isAvailable lispImpls; LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath nativeLibs; - unbundledPackage = { inputs, outputs }: rec { - mainLib = inputs.lisp.buildASDFSystem { + unbundledPackage = { lisp, evalFlag, extraArgs }: rec { + mainLib = lisp.buildASDFSystem { inherit pname version src systems nativeLibs; - lispLibs = lispLibs inputs.lisp; + lispLibs = lispLibs lisp; }; - lisp = inputs.lisp.withPackages (ps: [mainLib]) // { inherit (inputs.lisp) meta; }; - mainCode = '' - (let* ((_ (asdf:load-system :${pname})) - (component (asdf:find-system :${pname})) - (entry-point (asdf/system:component-entry-point component)) - (function (uiop:ensure-function entry-point))) - (funcall function) - (quit)) - ''; + lisp' = lisp.withPackages (ps: [mainLib]) // { inherit (lisp) meta; }; mainExe = pkgs.writeShellScriptBin pname '' export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} - exec ${outputs { inherit lisp; code = mainCode; }} - ''; - testCode = '' - (progn - (asdf:test-system :${pname}) - (quit)) + ${lisp'}/bin/${lisp'.meta.mainProgram} ${extraArgs} ${evalFlag} '(require "asdf")' ${evalFlag} "$(cat <