Compare commits

...

2 Commits

Author SHA1 Message Date
aviac
027f6a4b02 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)
2026-04-20 17:49:03 +00:00
aviac
42028f155b feat(nix): also add release-max-perf package build to flake outputs 2026-04-20 17:49:03 +00:00
2 changed files with 21 additions and 1 deletions

View File

@@ -8,7 +8,9 @@
callPackage,
rustPlatform,
cargoExtraArgs ? "",
rustflags ? "",
rocksdb ? callPackage ./rocksdb.nix { },
profile ? "release",
}:
let
# see https://crane.dev/API.html#cranelibfiltercargosources
@@ -35,6 +37,8 @@ let
env = {
ROCKSDB_INCLUDE_DIR = "${rocksdb}/include";
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
CARGO_PROFILE = profile;
RUSTFLAGS = rustflags;
};
};
in

View File

@@ -5,6 +5,7 @@
{
perSystem =
{
self',
pkgs,
craneLib,
...
@@ -12,7 +13,22 @@
{
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:
#
# - release-high-perf
max-perf = self'.packages.default.override {
profile = "release-max-perf";
};
};
};
}