diff --git a/flake.nix b/flake.nix index 8c68cac..d427fe8 100644 --- a/flake.nix +++ b/flake.nix @@ -25,6 +25,7 @@ static-openssl = (final.openssl.override { static = true; }); static-zlib = final.zlib.override { shared = false; }; static-pcre = final.pcre.override { shared = false; }; + static-snappy = final.snappy.override { static = true; }; static-libblst = final.libblst.overrideDerivation (old: { configureFlags = old.configureFlags ++ [ "--enable-static" "--disable-shared" ]; buildPhase = '' @@ -41,6 +42,36 @@ sed 's/^ILIBS\>.*/ILIBS = liblmdb.a/' -i Makefile ''; }); + # liburing always builds both static and dynamic libraries, so we remove the .so + # target the same way nixpkgs does for isStatic platforms. + static-liburing = final.liburing.overrideAttrs (old: { + dontdisableStatic = true; + # There are several files in man/ that have the same filename but with + # different case. When building on macOS, Nix renames these files with a + # "~nix~case~hack~" suffix, and then the Makefile won't be able to find them + # during the installPhase. Copy these back over the original. This should not + # cause any case conflicts, because it will be built in a Linux VM. + preInstall = '' + # Rename any case-hacked files back to their original names + for f in man/*~nix~case~hack~*; do + if [ -f "$f" ]; then + mv "$f" "''${f%~nix~case~hack~*}" + fi + done + ''; + + postInstall = '' + # Always builds both static and dynamic libraries, so we need to remove the + # dynamic libraries. + rm $out/lib/liburing*.so* + + # Copy the examples into $bin. Most reverse dependency of + # this package should reference only the $out output + for file in $(find ./examples -executable -type f); do + install -Dm555 -t "$bin/bin" "$file" + done + ''; + }); }); # nixpkgs defines happy = justStaticExecutables haskellPackages.happy diff --git a/iog-libs.nix b/iog-libs.nix index dcc701e..8138033 100644 --- a/iog-libs.nix +++ b/iog-libs.nix @@ -22,13 +22,16 @@ in { # Present in ALL shell types (dynamic, static, cross-js, cross-windows). crypto = map resolve [ "libblst" "libsodium-vrf" "secp256k1" ]; - # Data-storage libraries (ouroboros-consensus / cardano-lmdb). + # Data-storage libraries (ouroboros-consensus / cardano-lmdb / cardano-rpc). # Dynamic and static shells only — not meaningful for JS/Windows cross. - data = map resolve [ "lmdb" ]; + data = + map resolve ([ "lmdb" "snappy" ] + # liburing is Linux-only (io_uring is a Linux kernel feature). + ++ pkgs.lib.optionals pkgs.stdenv.isLinux [ "liburing" ]); # Development/CI tools (not linked into builds). Dynamic and static only. - tools = with pkgs; [ cbor-diag cddl gh icu jq yq-go ]; + tools = with pkgs; [ cbor-diag cddl gh icu jq protobuf yq-go ]; - # Minimal tool set for cross-compilation targets (CDDL/CBOR validation). - cross-tools = with pkgs; [ cbor-diag cddl ]; + # Build tools for cross-compilation targets (validation / code generation). + cross-tools = with pkgs; [ cbor-diag cddl protobuf ]; } diff --git a/tool-map.nix b/tool-map.nix index 43b4fd5..2fdf988 100644 --- a/tool-map.nix +++ b/tool-map.nix @@ -15,7 +15,7 @@ let f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d - --sha256: sha256-P0hOiQyh54Y5Pyl9rjpEE5Er/u83aeXIKBygzniRZtk= + --sha256: sha256-7jhEysaHgczdNolOCuE9K6ZpLD3KJzsGSlgPHlZOvlg= if impl(ghc < 9.13) active-repositories: hackage.haskell.org