From a6f468f0d33a324cce5daf6d48e7bcf6b80a4c4b Mon Sep 17 00:00:00 2001 From: quapka Date: Mon, 22 Jul 2024 13:37:32 +0200 Subject: Build shims in separate files --- flake.nix | 46 +++------------------------------------------- nix/boringsslshim.nix | 28 ++++++++++++++++++++++++++++ nix/libresslshim.nix | 23 +++++++++++++++++++++++ nix/mbedtlsshim.nix | 22 ++++++++++++++++++++++ 4 files changed, 76 insertions(+), 43 deletions(-) create mode 100644 nix/boringsslshim.nix create mode 100644 nix/libresslshim.nix create mode 100644 nix/mbedtlsshim.nix diff --git a/flake.nix b/flake.nix index 680085a..e081630 100644 --- a/flake.nix +++ b/flake.nix @@ -43,30 +43,6 @@ }); - boringsslShim = with pkgs; stdenv.mkDerivation { - name = "BoringSSLShim"; - src = ./standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; - - buildInputs = [ - patched_boringssl - pkg-config - jdk11_headless - ]; - - buildPhase = '' - make boringssl - ''; - - BORINGSSL_CFLAGS = "${patched_boringssl.dev.outPath}/include"; - # LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [ - # patched_boringssl - # ]; - - installPhase = '' - mkdir --parents $out/lib - cp boringssl_provider.so $out/lib - ''; - }; libressl = pkgs.libressl.overrideAttrs (_old: rec { # devLibPath = pkgs.lib.makeLibraryPath [ pkgs.libressl.dev ]; @@ -103,25 +79,9 @@ ]; }); - mbedtlsShim = with pkgs; stdenv.mkDerivation rec { - name = "MbedTLSShim"; - src = ./standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; - - buildInputs = [ - mbedtls - pkg-config - jdk11_headless - ]; - - buildPhase = '' - make mbedtls - ''; - - installPhase = '' - mkdir --parents $out/lib - cp mbedtls_provider.so $out/lib - ''; - }; + libresslShim = import ./nix/libresslshim.nix { pkgs = pkgs; libressl = libressl; }; + boringsslShim = import ./nix/boringsslshim.nix { pkgs = pkgs; boringssl = patched_boringssl; }; + mbedtlsShim = import ./nix/mbedtlsshim.nix { pkgs = pkgs; }; overlays = []; pkgs = import nixpkgs { inherit system overlays; diff --git a/nix/boringsslshim.nix b/nix/boringsslshim.nix new file mode 100644 index 0000000..1ed63d3 --- /dev/null +++ b/nix/boringsslshim.nix @@ -0,0 +1,28 @@ +{ + pkgs + , boringssl +}: +with pkgs; stdenv.mkDerivation { + name = "BoringSSLShim"; + src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; + + buildInputs = [ + boringssl + pkg-config + jdk11_headless + ]; + + buildPhase = '' + make boringssl + ''; + + BORINGSSL_CFLAGS = "${boringssl.dev.outPath}/include"; + # LD_LIBRARY_PATH = with pkgs; lib.makeLibraryPath [ + # boringssl + # ]; + + installPhase = '' + mkdir --parents $out/lib + cp boringssl_provider.so $out/lib + ''; +} diff --git a/nix/libresslshim.nix b/nix/libresslshim.nix new file mode 100644 index 0000000..97bc3d9 --- /dev/null +++ b/nix/libresslshim.nix @@ -0,0 +1,23 @@ +{ + pkgs + , libressl +}: +with pkgs; stdenv.mkDerivation rec { + name = "LibreSSLShim"; + src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; + + buildInputs = [ + libressl + pkg-config + jdk11_headless + ]; + + buildPhase = '' + make libressl + ''; + + installPhase = '' + mkdir --parents $out/lib + cp libressl_provider.so $out/lib + ''; +} diff --git a/nix/mbedtlsshim.nix b/nix/mbedtlsshim.nix new file mode 100644 index 0000000..2dff2f0 --- /dev/null +++ b/nix/mbedtlsshim.nix @@ -0,0 +1,22 @@ +{ + pkgs +}: +with pkgs; stdenv.mkDerivation rec { + name = "MbedTLSShim"; + src = ../standalone/src/main/resources/cz/crcs/ectester/standalone/libs/jni; + + buildInputs = [ + mbedtls + pkg-config + jdk11_headless + ]; + + buildPhase = '' + make mbedtls + ''; + + installPhase = '' + mkdir --parents $out/lib + cp mbedtls_provider.so $out/lib + ''; +} -- cgit v1.2.3-70-g09d2