From ba2f22b5d314df23d306088ee02b6f07529d760f Mon Sep 17 00:00:00 2001 From: strawberry Date: Tue, 21 May 2024 21:01:39 -0400 Subject: [PATCH] nix: remove jemalloc (now default) targets, add jq input for default jq input change was from https://gitlab.computer.surgery/matrix/grapevine-fork/-/commit/17eb3545906d21f2ed18f0f0f917a4638f12ef6c to prevent unnecessary bindgen rebuilds Signed-off-by: strawberry --- flake.nix | 23 ----------------------- nix/pkgs/main/default.nix | 13 ++++++++++--- 2 files changed, 10 insertions(+), 26 deletions(-) diff --git a/flake.nix b/flake.nix index 612365e7..10db94cc 100644 --- a/flake.nix +++ b/flake.nix @@ -105,11 +105,6 @@ hmalloc = scopeHost.main.override { features = ["hardened_malloc"]; }; oci-image = scopeHost.oci-image; - oci-image-jemalloc = scopeHost.oci-image.override { - main = scopeHost.main.override { - features = ["jemalloc"]; - }; - }; oci-image-hmalloc = scopeHost.oci-image.override { main = scopeHost.main.override { features = ["hardened_malloc"]; @@ -144,14 +139,6 @@ value = scopeCrossStatic.main; } - # An output for a statically-linked binary with jemalloc - { - name = "${binaryName}-jemalloc"; - value = scopeCrossStatic.main.override { - features = ["jemalloc"]; - }; - } - # An output for a statically-linked binary with hardened_malloc { name = "${binaryName}-hmalloc"; @@ -166,16 +153,6 @@ value = scopeCrossStatic.oci-image; } - # An output for an OCI image based on that binary with jemalloc - { - name = "oci-image-${crossSystem}-jemalloc"; - value = scopeCrossStatic.oci-image.override { - main = scopeCrossStatic.main.override { - features = ["jemalloc"]; - }; - }; - } - # An output for an OCI image based on that binary with hardened_malloc { name = "oci-image-${crossSystem}-hmalloc"; diff --git a/nix/pkgs/main/default.nix b/nix/pkgs/main/default.nix index 776dc591..2d2e4ab8 100644 --- a/nix/pkgs/main/default.nix +++ b/nix/pkgs/main/default.nix @@ -1,6 +1,7 @@ # Dependencies (keep sorted) { craneLib , inputs +, jq , lib , libiconv , liburing @@ -87,6 +88,9 @@ buildDepsOnlyEnv = }); in { + # https://crane.dev/faq/rebuilds-bindgen.html + NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa"; + CARGO_PROFILE = profile; ROCKSDB_INCLUDE_DIR = "${rocksdb'}/include"; ROCKSDB_LIB_DIR = "${rocksdb'}/lib"; @@ -146,6 +150,12 @@ commonAttrs = { # weirdness", pkgs.rustPlatform.bindgenHook on its own doesn't quite do the # right thing here. pkgsBuildHost.rustPlatform.bindgenHook + + # We don't actually depend on `jq`, but crane's `buildPackage` does, but + # its `buildDepsOnly` doesn't. This causes those two derivations to have + # differing values for `NIX_CFLAGS_COMPILE`, which contributes to spurious + # rebuilds of bindgen and its depedents. + jq ] ++ lib.optionals stdenv.isDarwin [ # https://github.com/NixOS/nixpkgs/issues/206242 @@ -173,9 +183,6 @@ craneLib.buildPackage ( commonAttrs // { cargoCheckCommand = ""; doCheck = false; - # https://crane.dev/faq/rebuilds-bindgen.html - NIX_OUTPATH_USED_AS_RANDOM_SEED = "aaaaaaaaaa"; - env = buildPackageEnv; passthru = {