Skip to content

Commit

Permalink
tree-wide: make rust jemalloc-sys use nixpkgs jemalloc build
Browse files Browse the repository at this point in the history
  • Loading branch information
yu-re-ka committed Oct 20, 2023
1 parent 35925e5 commit 799fff8
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 14 deletions.
2 changes: 2 additions & 0 deletions pkgs/applications/blockchains/lighthouse/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
, rustPlatform
, Security
, sqlite
, rust-jemalloc-sys
, stdenv
, SystemConfiguration
, testers
Expand Down Expand Up @@ -70,6 +71,7 @@ rustPlatform.buildRustPackage rec {

buildInputs = [
sqlite
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [
CoreFoundation
Security
Expand Down
5 changes: 4 additions & 1 deletion pkgs/applications/blockchains/polkadot/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
, lib
, protobuf
, rocksdb
, rust-jemalloc-sys-unprefixed
, rustPlatform
, rustc-wasm32
, stdenv
Expand Down Expand Up @@ -60,7 +61,9 @@ rustPlatform.buildRustPackage rec {
rustc-wasm32.llvmPackages.lld
];

buildInputs = lib.optionals stdenv.isDarwin [ Security SystemConfiguration ];
buildInputs = [
rust-jemalloc-sys-unprefixed
] ++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration ];

# NOTE: we need to force lld otherwise rust-lld is not found for wasm32 target
CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld";
Expand Down
2 changes: 2 additions & 0 deletions pkgs/applications/office/activitywatch/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
, pkg-config
, perl
, openssl
, rust-jemalloc-sys
, python3
, wrapQtAppsHook
, qtbase
Expand Down Expand Up @@ -173,6 +174,7 @@ rec {

buildInputs = [
openssl
rust-jemalloc-sys
];

postFixup = ''
Expand Down
5 changes: 4 additions & 1 deletion pkgs/development/python-modules/polars/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
, libiconv
, fetchFromGitHub
, typing-extensions
, rust-jemalloc-sys
, darwin
}:
let
Expand Down Expand Up @@ -49,7 +50,9 @@ buildPythonPackage {

nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];

buildInputs = lib.optionals stdenv.isDarwin [
buildInputs = [
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [
libiconv
darwin.apple_sdk.frameworks.Security
];
Expand Down
11 changes: 4 additions & 7 deletions pkgs/development/tools/ruff/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
, installShellFiles
, stdenv
, darwin
, rust-jemalloc-sys
# tests
, ruff-lsp
}:
Expand Down Expand Up @@ -31,19 +32,15 @@ rustPlatform.buildRustPackage rec {
installShellFiles
];

buildInputs = lib.optionals stdenv.isDarwin [
buildInputs = [
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.CoreServices
];

cargoBuildFlags = [ "--package=ruff_cli" ];
cargoTestFlags = cargoBuildFlags;

preBuild = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
# See https://github.com/jemalloc/jemalloc/issues/1997
# Using a value of 48 should work on both emulated and native x86_64-darwin.
export JEMALLOC_SYS_WITH_LG_VADDR=48
'';

# tests expect no colors
preCheck = ''
export NO_COLOR=1
Expand Down
2 changes: 2 additions & 0 deletions pkgs/servers/kanidm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
, sqlite
, pam
, bashInteractive
, rust-jemalloc-sys
}:

let
Expand Down Expand Up @@ -59,6 +60,7 @@ rustPlatform.buildRustPackage rec {
openssl
sqlite
pam
rust-jemalloc-sys
];

# The UI needs to be in place before the tests are run.
Expand Down
6 changes: 5 additions & 1 deletion pkgs/servers/matrix-conduit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
, darwin
, nixosTests
, rocksdb
, rust-jemalloc-sys
}:

rustPlatform.buildRustPackage rec {
Expand Down Expand Up @@ -42,7 +43,10 @@ rustPlatform.buildRustPackage rec {
pkg-config
];

buildInputs = [ sqlite ] ++ lib.optionals stdenv.isDarwin [
buildInputs = [
sqlite
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
];

Expand Down
6 changes: 5 additions & 1 deletion pkgs/servers/search/qdrant/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
, stdenv
, pkg-config
, openssl
, rust-jemalloc-sys
, nix-update-script
, Security
}:
Expand Down Expand Up @@ -32,7 +33,10 @@ rustPlatform.buildRustPackage rec {
# Needed to get openssl-sys to use pkg-config.
OPENSSL_NO_VENDOR = 1;

buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security ];
buildInputs = [
openssl
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [ Security ];

nativeBuildInputs = [ protobuf rustPlatform.bindgenHook pkg-config ];

Expand Down
5 changes: 4 additions & 1 deletion pkgs/servers/search/quickwit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
, rustPlatform
, nix-update-script
, protobuf
, rust-jemalloc-sys
, Security
}:

Expand Down Expand Up @@ -32,7 +33,9 @@ rustPlatform.buildRustPackage rec {

sourceRoot = "${src.name}/quickwit";

buildInputs = lib.optionals stdenv.isDarwin [ Security ];
buildInputs = [
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [ Security ];

cargoLock = {
lockFile = ./Cargo.lock;
Expand Down
4 changes: 3 additions & 1 deletion pkgs/tools/misc/fd/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, rustPlatform, fetchFromGitHub, installShellFiles, testers, fd }:
{ lib, rustPlatform, fetchFromGitHub, installShellFiles, rust-jemalloc-sys, testers, fd }:

rustPlatform.buildRustPackage rec {
pname = "fd";
Expand All @@ -15,6 +15,8 @@ rustPlatform.buildRustPackage rec {

nativeBuildInputs = [ installShellFiles ];

buildInputs = [ rust-jemalloc-sys ];

# skip flaky test
checkFlags = [
"--skip=test_owner_current_group"
Expand Down
2 changes: 2 additions & 0 deletions pkgs/tools/misc/turbo/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
, openssl
, extra-cmake-modules
, fontconfig
, rust-jemalloc-sys
, testers
, turbo
, nix-update-script
Expand Down Expand Up @@ -149,6 +150,7 @@ rustPlatform.buildRustPackage {
buildInputs = [
openssl
fontconfig
rust-jemalloc-sys
] ++ lib.optionals stdenv.isDarwin [
IOKit
CoreServices
Expand Down
3 changes: 2 additions & 1 deletion pkgs/tools/misc/vector/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
, rdkafka
, oniguruma
, zstd
, rust-jemalloc-sys
, Security
, libiconv
, coreutils
Expand Down Expand Up @@ -59,7 +60,7 @@ rustPlatform.buildRustPackage {
};
};
nativeBuildInputs = [ pkg-config cmake perl git rustPlatform.bindgenHook ];
buildInputs = [ oniguruma openssl protobuf rdkafka zstd ]
buildInputs = [ oniguruma openssl protobuf rdkafka zstd rust-jemalloc-sys ]
++ lib.optionals stdenv.isDarwin [ Security libiconv coreutils CoreServices ];

# needed for internal protobuf c wrapper library
Expand Down

0 comments on commit 799fff8

Please sign in to comment.