Skip to content

Commit

Permalink
fix crypto overlay so that it can be imported after haskell.nix
Browse files Browse the repository at this point in the history
 as it should.

 This is done by adding proper support for musl to libsecp256k1 buid,
 so that we don't rely on haskell.nix overrideAttrs for this.
  • Loading branch information
jbgi committed May 30, 2023
1 parent 86421fd commit 6965706
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions overlays/crypto/default.nix
Expand Up @@ -10,15 +10,18 @@ inputs: final: prev: rec {
libblst = final.callPackage ./libblst.nix { inherit inputs; };
libsecp256k1 = final.callPackage ./libsecp256k1.nix { inherit inputs; };

# override the nixpkgs ones which do not have the `lib` prefix.
secp256k1 = libsecp256k1;
# XXX: deprecated: override the nixpkgs ones which do not have the `lib` prefix.
secp256k1 = builtins.trace "WARNING: overriding nixpkgs' secp256k1 with iohk-nix libsecp256k1. This override will go away in July 2023, please use libsecp256k1 directly."
libsecp256k1;
}
# Make these libraries also available to haskell-nix's pkg-config
# map when solving for dependencies with cabal.
// prev.lib.optionalAttrs (prev ? haskell-nix) {
haskell-nix = prev.haskell-nix // {
extraPkgconfigMappings = prev.haskell-nix.extraPkgconfigMappings // {
"libblst" = [ "libblst" ];
# switch haskell.nix default mapping from `secp256k1` to our `libsecp256k1`.
"libsecp256k1" = ["libsecp256k1"];
# map libsoidum to our libsodium-vrf, if you include the iohk-nix
# crypto overlay, you _do_ want the custom libsoidum.
"libsodium" = [ "libsodium-vrf" ];
Expand Down
4 changes: 3 additions & 1 deletion overlays/crypto/libsecp256k1.nix
Expand Up @@ -11,6 +11,8 @@ stdenv.mkDerivation rec {
configureFlags = [
"--enable-benchmark=no"
"--enable-module-recovery"
] ++ lib.optional stdenv.hostPlatform.isMusl [
"--enable-static"
];

doCheck = true;
Expand All @@ -27,4 +29,4 @@ stdenv.mkDerivation rec {
maintainers = with maintainers; [ ];
platforms = with platforms; all;
};
}
}

0 comments on commit 6965706

Please sign in to comment.