From 25b1fb95d2899b6428181c5cdc8d878cb28822dd Mon Sep 17 00:00:00 2001 From: mangoiv Date: Tue, 3 Oct 2023 17:37:15 +0200 Subject: [PATCH 1/2] [fix] some fixes related to nix - repair fixed output derivation cargo packages - add benchmarkdepends to the devShell - make the missing build-tool-depends more reproducible --- cabal.project | 3 +++ changelog.d/3-bug-fixes/WBP-4959 | 1 + changelog.d/3-bug-fixes/WBP-4961 | 1 + nix/pkgs/cryptobox/default.nix | 13 ++++++++++--- nix/pkgs/mls-test-cli/default.nix | 17 +++++++++++------ nix/pkgs/zauth/default.nix | 7 ++++++- nix/wire-server.nix | 5 +++++ 7 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 changelog.d/3-bug-fixes/WBP-4959 create mode 100644 changelog.d/3-bug-fixes/WBP-4961 diff --git a/cabal.project b/cabal.project index 96d20a6f060..cbe9d0c9e17 100644 --- a/cabal.project +++ b/cabal.project @@ -1,3 +1,6 @@ +repository hackage.haskell.org + url: https://hackage.haskell.org/ +index-state: 2023-10-03T15:17:00Z packages: integration , libs/bilge/ diff --git a/changelog.d/3-bug-fixes/WBP-4959 b/changelog.d/3-bug-fixes/WBP-4959 new file mode 100644 index 00000000000..c053654fa0b --- /dev/null +++ b/changelog.d/3-bug-fixes/WBP-4959 @@ -0,0 +1 @@ +Fix nix derivations for rust packages diff --git a/changelog.d/3-bug-fixes/WBP-4961 b/changelog.d/3-bug-fixes/WBP-4961 new file mode 100644 index 00000000000..ef17d4d7bab --- /dev/null +++ b/changelog.d/3-bug-fixes/WBP-4961 @@ -0,0 +1 @@ +Ensure benchmarking dependencies are provided by nix development environment diff --git a/nix/pkgs/cryptobox/default.nix b/nix/pkgs/cryptobox/default.nix index 5945c616f22..98d5adf8aa3 100644 --- a/nix/pkgs/cryptobox/default.nix +++ b/nix/pkgs/cryptobox/default.nix @@ -7,7 +7,7 @@ }: rustPlatform.buildRustPackage rec { - name = "cryptobox-c-${version}"; + pname = "cryptobox-c"; version = "2019-06-17"; nativeBuildInputs = [ pkg-config ]; buildInputs = [ libsodium ]; @@ -17,12 +17,19 @@ rustPlatform.buildRustPackage rec { rev = "4067ad96b125942545dbdec8c1a89f1e1b65d013"; sha256 = "1i9dlhw0xk1viglyhail9fb36v1awrypps8jmhrkz8k1bhx98ci3"; }; - cargoSha256 = "sha256-Afr3ShCXDCwTQNdeCZbA5/aosRt+KFpGfT1mrob6cog="; - patchLibs = lib.optionalString stdenv.isDarwin '' install_name_tool -id $out/lib/libcryptobox.dylib $out/lib/libcryptobox.dylib ''; + cargoLock = { + lockFile = "${src}/Cargo.lock"; + outputHashes = { + "cryptobox-1.0.0" = "sha256-Ewo+FtEGTZ4/U7Ow6mGTQkxS4IQYcEthr5/xG9BRTWk="; + "hkdf-0.2.0" = "sha256-cdgR94c40JFIjBf8NfZPXPGLU60BlAZX/SQnRHAXGOg="; + "proteus-1.0.0" = "sha256-ppMt56RY5K3rOwO7MEdY6d3t96sbHZzDB/nPNNp35DY="; + }; + }; + postInstall = '' ${patchLibs} mkdir -p $out/include diff --git a/nix/pkgs/mls-test-cli/default.nix b/nix/pkgs/mls-test-cli/default.nix index 8562916aca7..66e9762c5d6 100644 --- a/nix/pkgs/mls-test-cli/default.nix +++ b/nix/pkgs/mls-test-cli/default.nix @@ -1,15 +1,13 @@ { fetchFromGitHub -, lib , libsodium , perl , pkg-config , rustPlatform -, stdenv , gitMinimal }: rustPlatform.buildRustPackage rec { - name = "mls-test-cli-${version}"; + pname = "mls-test-cli"; version = "0.6.0"; nativeBuildInputs = [ pkg-config perl gitMinimal ]; buildInputs = [ libsodium ]; @@ -19,9 +17,16 @@ rustPlatform.buildRustPackage rec { sha256 = "sha256-/XQ/9oQTPkRqgMzDGRm+Oh9jgkdeDM1vRJ6/wEf2+bY="; rev = "c6f80be2839ac1ed2894e96044541d1c3cf6ecdf"; }; + cargoLock = { + lockFile = "${src}/Cargo.lock"; + outputHashes = { + "openmls-0.4.1" = "sha256-oEPziXyGmPV6C80lQpi0z7Ehl3/mGFz0HaePT8h3y0Q="; + "ring-0.17.0-not-released-yet" = "sha256-n8KuJRcOdMduPTjDBU1n1eec3w9Eat/8czvGRTGbqsI="; + "x509-parser-0.13.1" = "sha256-ipHZm3MmiOssGkFC5O4h/Y3p1U0aj7wu+LGaBuQImuU="; + }; + }; doCheck = false; - cargoSha256 = "sha256-AlZrxa7f5JwxxrzFBgeFSaYU6QttsUpfLYfq1HzsdbE="; - cargoDepsHook = '' - mkdir -p mls-test-cli-${version}-vendor.tar.gz/ring/.git + preBuild = '' + mkdir $CARGO_HOME/cargo-vendor-dir/ring-0.17.0-not-released-yet/.git ''; } diff --git a/nix/pkgs/zauth/default.nix b/nix/pkgs/zauth/default.nix index 969a76fc333..19ade192f8f 100644 --- a/nix/pkgs/zauth/default.nix +++ b/nix/pkgs/zauth/default.nix @@ -16,7 +16,12 @@ rustPlatform.buildRustPackage rec { src = nix-gitignore.gitignoreSourcePure [ ../../../.gitignore ] ../../../libs/libzauth; sourceRoot = "libzauth/libzauth-c"; - cargoSha256 = "sha256-f/MNUrEQaPzSUHtnZ0jARMwBswS+Sh0Swe+2D+hpHF4="; + cargoLock = { + lockFile = "${src}/libzauth-c/Cargo.lock"; + outputHashes = { + "jwt-simple-0.11.3" = "sha256-H9gCwqxUlffi8feQ4xjiTbeyT1RMrfZAsPsNWapfR9c="; + }; + }; patchLibs = lib.optionalString stdenv.isDarwin '' install_name_tool -id $out/lib/libzauth.dylib $out/lib/libzauth.dylib diff --git a/nix/wire-server.nix b/nix/wire-server.nix index 129d5e8c2b2..8df97928a7c 100644 --- a/nix/wire-server.nix +++ b/nix/wire-server.nix @@ -124,6 +124,9 @@ let then drv else hlib.dontHaddock drv; + bench = _: drv: + hlib.doBenchmark drv; + overrideAll = fn: overrides: attrsets.mapAttrs fn (overrides); in @@ -132,6 +135,7 @@ let opt docs tests + bench ]; manualOverrides = import ./manual-overrides.nix (with pkgs; { inherit hlib libsodium protobuf mls-test-cli fetchpatch; @@ -419,6 +423,7 @@ let }; shell = (hPkgs localModsOnlyTests).shellFor { + doBenchmark = true; packages = p: builtins.map (e: p.${e}) wireServerPackages; }; ghcWithPackages = shell.nativeBuildInputs ++ shell.buildInputs; From eabb79d333f0dc652e04fc5c6a6a4097d49522e6 Mon Sep 17 00:00:00 2001 From: Magnus Viernickel Date: Thu, 5 Oct 2023 10:18:18 +0200 Subject: [PATCH 2/2] [fix] apply the fix required by Akshay; explain creation of the .git dir in ring --- nix/pkgs/mls-test-cli/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/nix/pkgs/mls-test-cli/default.nix b/nix/pkgs/mls-test-cli/default.nix index 66e9762c5d6..9c283bb6837 100644 --- a/nix/pkgs/mls-test-cli/default.nix +++ b/nix/pkgs/mls-test-cli/default.nix @@ -26,6 +26,15 @@ rustPlatform.buildRustPackage rec { }; }; doCheck = false; + /* + if ring does not detect it is a git repository (checks for .git) dir + it will expect pregenerated files that we do not have at our exposure + after pulling with the git fetcher + + we put this patch in the preBuild phase because we need to have the + cargo-vendor-dir available and the dedicated cargo phase for this + in nixpkgs do not trigger + */ preBuild = '' mkdir $CARGO_HOME/cargo-vendor-dir/ring-0.17.0-not-released-yet/.git '';