Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] some fixes related to nix #3628

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
repository hackage.haskell.org
url: https://hackage.haskell.org/
index-state: 2023-10-03T15:17:00Z
packages:
integration
, libs/bilge/
Expand Down
1 change: 1 addition & 0 deletions changelog.d/3-bug-fixes/WBP-4959
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix nix derivations for rust packages
1 change: 1 addition & 0 deletions changelog.d/3-bug-fixes/WBP-4961
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Ensure benchmarking dependencies are provided by nix development environment
13 changes: 10 additions & 3 deletions nix/pkgs/cryptobox/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}:

rustPlatform.buildRustPackage rec {
name = "cryptobox-c-${version}";
pname = "cryptobox-c";
version = "2019-06-17";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libsodium ];
Expand All @@ -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
Expand Down
26 changes: 20 additions & 6 deletions nix/pkgs/mls-test-cli/default.nix
Original file line number Diff line number Diff line change
@@ -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 ];
Expand All @@ -19,9 +17,25 @@ 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
/*
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
MangoIV marked this conversation as resolved.
Show resolved Hide resolved
'';
}
7 changes: 6 additions & 1 deletion nix/pkgs/zauth/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions nix/wire-server.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ let
then drv
else hlib.dontHaddock drv;

bench = _: drv:
hlib.doBenchmark drv;

overrideAll = fn: overrides:
attrsets.mapAttrs fn (overrides);
in
Expand All @@ -132,6 +135,7 @@ let
opt
docs
tests
bench
];
manualOverrides = import ./manual-overrides.nix (with pkgs; {
inherit hlib libsodium protobuf mls-test-cli fetchpatch;
Expand Down Expand Up @@ -419,6 +423,7 @@ let
};

shell = (hPkgs localModsOnlyTests).shellFor {
doBenchmark = true;
packages = p: builtins.map (e: p.${e}) wireServerPackages;
};
ghcWithPackages = shell.nativeBuildInputs ++ shell.buildInputs;
Expand Down