From 027f6a4b025e75a76354a1912f6186f941d6147f Mon Sep 17 00:00:00 2001 From: aviac Date: Mon, 20 Apr 2026 14:56:09 +0200 Subject: [PATCH] feat(nix): allow override of RUSTFLAGS for certain features - enabling the `http3` features requires unstable features, namely `reqwest_unstable` - the main suggestion of cargo is to enable this through RUSTFLAGS - we had no way to customize RUSTFLAGS, now we do - changed the max-perf package to showcase this feature - also turn on http3 by default in both max-perf and the default build (jade approved this) --- nix/packages/continuwuity.nix | 2 ++ nix/packages/default.nix | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/nix/packages/continuwuity.nix b/nix/packages/continuwuity.nix index e5cf07c2c..7dc9e9e21 100644 --- a/nix/packages/continuwuity.nix +++ b/nix/packages/continuwuity.nix @@ -8,6 +8,7 @@ callPackage, rustPlatform, cargoExtraArgs ? "", + rustflags ? "", rocksdb ? callPackage ./rocksdb.nix { }, profile ? "release", }: @@ -37,6 +38,7 @@ let ROCKSDB_INCLUDE_DIR = "${rocksdb}/include"; ROCKSDB_LIB_DIR = "${rocksdb}/lib"; CARGO_PROFILE = profile; + RUSTFLAGS = rustflags; }; }; in diff --git a/nix/packages/default.nix b/nix/packages/default.nix index 28fe87495..6052f3649 100644 --- a/nix/packages/default.nix +++ b/nix/packages/default.nix @@ -13,7 +13,14 @@ { packages = { rocksdb = pkgs.callPackage ./rocksdb.nix { }; - default = pkgs.callPackage ./continuwuity.nix { inherit self craneLib; }; + default = pkgs.callPackage ./continuwuity.nix { + inherit self craneLib; + # extra features via `cargoExtraArgs` + cargoExtraArgs = "-F http3"; + # extra RUSTFLAGS via `rustflags` + # the stuff below is required for http3 + rustflags = "--cfg reqwest_unstable"; + }; # users may also override this with other cargo profiles to build for other feature sets # # other examples include: