From 7a723176e6e233eb8426864d231658dbabf1213a Mon Sep 17 00:00:00 2001 From: Hamish Mackenzie Date: Fri, 1 Sep 2023 15:36:17 +1200 Subject: [PATCH] Allow order independent overlays Currently the haskell.nix overlays ignore any `defaultModules` and `extraPkgconfigMappings` set in `prev`. This means it is not possible to have an overly include these in an way that will work both before and after the haskell.nix overlays. With this change an overlay can be written like this: ``` final: prev: { haskell-nix = prev.haskell-nix or {} // { extraPkgconfigMappings = prev.haskell-nix.extraPkgconfigMappings or {} // { ... ``` It can then be included before or after the haskell.nix overlays. --- overlays/haskell.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overlays/haskell.nix b/overlays/haskell.nix index 0fc65f66c2..4eff1c0a5f 100644 --- a/overlays/haskell.nix +++ b/overlays/haskell.nix @@ -9,10 +9,10 @@ final: prev: { # Default modules, these will always be included. # They are here to be overridden/added to by other # overlays. - defaultModules = []; + defaultModules = prev.haskell-nix.defaultModules or []; # Additional user-provided mappings to augment ./../lib/pkgconf-nixpkgs-map.nix - extraPkgconfigMappings = {}; + extraPkgconfigMappings = prev.haskell-nix.extraPkgconfigMappings or {}; # Nix Flake based source pins. # To update all inputs, get unstable Nix and then `nix flake update --recreate-lock-file` # Or `nix-shell -p nixUnstable --run "nix --experimental-features 'nix-command flakes' flake update --recreate-lock-file"`