Skip to content

Commit

Permalink
Add a static-only variant of snappy dependency
Browse files Browse the repository at this point in the history
By using that in the hydra-node linking, we always link statically
against this library (could not easily have one derivation yield both,
.a and .so files)
  • Loading branch information
ch1bo committed Feb 24, 2025
1 parent 9ff151f commit ec34a86
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
# FIXME: we are missing a static linked snappy (other libraries are provided through overlays)
# This overlay contains libsodium and libblst libraries
inputs.iohk-nix.overlays.crypto
# This overlay contains pkg-config mappings via haskell.nix to use the
Expand Down
5 changes: 5 additions & 0 deletions nix/hydra/project.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,13 @@ pkgs.haskell-nix.project {
"-L${lib.getLib static-secp256k1}/lib"
"-L${lib.getLib static-openssl}/lib"
"-L${lib.getLib static-libblst}/lib"
"-L${lib.getLib static-snappy}/lib"
];
})
# Always use static snappy (from overlay, see nix/static-libs.nix)
{
packages.hydra-node.ghcOptions = [ "-L${pkgs.lib.getLib pkgs.static-snappy}/lib" ];
}
{
# lib:ghc is a bit annoying in that it comes with it's own build-type:Custom, and then tries
# to call out to all kinds of silly tools that GHC doesn't really provide.
Expand Down
4 changes: 4 additions & 0 deletions nix/static-libs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,8 @@ final: prev: {
static-openssl = (final.openssl.override { static = true; });
static-zlib = final.zlib.override { shared = false; };
static-pcre = final.pcre.override { shared = false; };
# XXX: Not replicate the cmakeFlags but just drop the -DBUILD_SHARED_LIBS=ON from it
static-snappy = final.snappy.overrideDerivation (old: {
cmakeFlags = [ "-DSNAPPY_BUILD_TESTS=OFF" "-DSNAPPY_BUILD_BENCHMARKS=OFF" ];
});
}

0 comments on commit ec34a86

Please sign in to comment.