diff --git a/nix/packages/continuwuity.nix b/nix/packages/continuwuity.nix index 7dc9e9e21..68d053a9f 100644 --- a/nix/packages/continuwuity.nix +++ b/nix/packages/continuwuity.nix @@ -9,6 +9,7 @@ rustPlatform, cargoExtraArgs ? "", rustflags ? "", + target_cpu ? null, rocksdb ? callPackage ./rocksdb.nix { }, profile ? "release", }: @@ -39,7 +40,10 @@ let ROCKSDB_LIB_DIR = "${rocksdb}/lib"; CARGO_PROFILE = profile; RUSTFLAGS = rustflags; - }; + } + // (lib.optionalAttrs (target_cpu != null) { + TARGET_CPU = target_cpu; + }); }; in craneLib.buildPackage ( diff --git a/nix/packages/default.nix b/nix/packages/default.nix index 6052f3649..88a6ccd38 100644 --- a/nix/packages/default.nix +++ b/nix/packages/default.nix @@ -22,11 +22,13 @@ 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 { + # for features configuration see `default` package which enables http3 by default + + # example: different compilation profile and different target_cpu + max-perf-haswell = self'.packages.default.override { + # compiles explicitly for haswell arch cpus + target_cpu = "haswell"; + # compiles slower but with more thorough optimizations profile = "release-max-perf"; }; };