summary refs log tree commit diff
path: root/pkgs/development/lisp-modules
diff options
context:
space:
mode:
authorKasper Gałkowski <kgalkowski@comscore.com>2023-03-11 18:53:26 +0100
committerKasper Gałkowski <kgalkowski@comscore.com>2023-03-11 19:09:25 +0100
commitdae0dca5d1c9ad4150b91c55c5f4b54430b1413c (patch)
tree4acc5c73167c3017fce87e7af7342f37e773312c /pkgs/development/lisp-modules
parente758d73e0127bafd7947eda9775820ca53567c77 (diff)
downloadnixpkgs-dae0dca5d1c9ad4150b91c55c5f4b54430b1413c.tar
nixpkgs-dae0dca5d1c9ad4150b91c55c5f4b54430b1413c.tar.gz
nixpkgs-dae0dca5d1c9ad4150b91c55c5f4b54430b1413c.tar.bz2
nixpkgs-dae0dca5d1c9ad4150b91c55c5f4b54430b1413c.tar.lz
nixpkgs-dae0dca5d1c9ad4150b91c55c5f4b54430b1413c.tar.xz
nixpkgs-dae0dca5d1c9ad4150b91c55c5f4b54430b1413c.tar.zst
nixpkgs-dae0dca5d1c9ad4150b91c55c5f4b54430b1413c.zip
lisp-modules: second version of wrapLisp
The previous approach of trying to make both the `override` mechanism from
`mkDerivation` and the `overrideScope'` mechanism from `newScope` work together
resulted in hard to understand code, and there was a bug where once overridden
packages would lose the changes on next override with `packageOverrides`.

It's not ideal still, because Lisps created by `mkDerivation` will lose their
`pkgs` after using `override`.
Diffstat (limited to 'pkgs/development/lisp-modules')
-rw-r--r--pkgs/development/lisp-modules/nix-cl.nix29
1 files changed, 15 insertions, 14 deletions
diff --git a/pkgs/development/lisp-modules/nix-cl.nix b/pkgs/development/lisp-modules/nix-cl.nix
index 7e671e7cc63..d1a70bf5c8e 100644
--- a/pkgs/development/lisp-modules/nix-cl.nix
+++ b/pkgs/development/lisp-modules/nix-cl.nix
@@ -286,25 +286,26 @@ let
       '';
     });
 
-  wrapLisp = { pkg, faslExt, program ? pkg.pname, flags ? [], asdf ? pkgs.asdf_3_3 }:
+  wrapLisp = {
+    pkg
+    , faslExt
+    , program ? pkg.pname
+    , flags ? []
+    , asdf ? pkgs.asdf_3_3
+    , packageOverrides ? (self: super: {})
+  }:
     let
       spec = { inherit pkg faslExt program flags asdf; };
-      pkgs = commonLispPackagesFor spec;
+      pkgs = (commonLispPackagesFor spec).overrideScope' packageOverrides;
       withPackages = lispWithPackages pkgs;
-      override =
-        { packageOverrides ? (self: super: {}) , ... } @ attrs:
-        let
-          pkg' = spec.pkg.override attrs;
-          spec' = spec // { pkg = pkg'; };
-          pkgs = (commonLispPackagesFor spec').overrideScope' packageOverrides;
-          withPackages = lispWithPackages pkgs;
-        in pkg' // {
-          inherit pkgs withPackages override;
-          buildASDFSystem = args: build-asdf-system (args // spec');
+      withOverrides = packageOverrides:
+        wrapLisp {
+          inherit pkg faslExt program flags asdf;
+          inherit packageOverrides;
         };
-    in pkg // {
-      inherit pkgs withPackages override;
       buildASDFSystem = args: build-asdf-system (args // spec);
+    in pkg // {
+      inherit pkgs withPackages withOverrides buildASDFSystem;
     };
 
 in wrapLisp