Skip to content

Commit 9014e6e

Browse files
committed
Fix more override types
1 parent 77431cc commit 9014e6e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

overlays/haskell.nix

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -755,12 +755,22 @@ final: prev: {
755755
name = to-key p;
756756
value = {
757757
components = final.lib.optionalAttrs (config.packages ? ${p.pkg-name}) (
758-
builtins.mapAttrs (_: x: builtins.mapAttrs (_: x: final.lib.mkOverride 990 x)
759-
(builtins.removeAttrs x ["buildable" "planned" "depends" "build-tools"]))
760-
(final.lib.filterAttrs (_: x: x != null) config.packages.${p.pkg-name}.components));
758+
let
759+
inherit (config.packages.${p.pkg-name}) components;
760+
mapOptions = c:
761+
builtins.mapAttrs (_: x: final.lib.mkOverride 990 x)
762+
(builtins.removeAttrs c ["buildable" "planned" "depends" "build-tools"]) //
763+
builtins.mapAttrs (n: x: final.lib.mkOverride 90 x) (
764+
final.lib.filterAttrs (n: x: builtins.elem n ["depends" "build-tools"] && builtins.length x != 0) c);
765+
in
766+
final.lib.optionalAttrs (components.library or null != null) {
767+
library = mapOptions components.library;
768+
} // final.lib.optionalAttrs (components.setup or null != null) {
769+
setup = mapOptions components.setup;
770+
} // builtins.mapAttrs (ctype: cs: builtins.mapAttrs (cname: c: __trace "${ctype} ${cname}" mapOptions c) cs) (builtins.removeAttrs components ["library" "setup"]));
761771
} // builtins.mapAttrs (n: _:
762-
final.lib.mkIf (config.packages ? ${p.pkg-name}) (final.lib.mkOverride 995 config.packages.${p.pkg-name}.${n}))
763-
(import ../modules/package-options.nix { inherit haskellLib; inherit (final) lib; }).options;
772+
final.lib.mkIf (config.packages ? ${p.pkg-name}) (final.lib.mkOverride (if n == "src" then 90 else 995) config.packages.${p.pkg-name}.${n}))
773+
((import ../modules/package-options.nix { inherit haskellLib; inherit (final) lib; }).options // { src = {}; });
764774
}) (final.lib.filter (p: to-key p != p.pkg-name) plan-json.install-plan));
765775
})
766776
({lib, ...}: {

0 commit comments

Comments
 (0)