mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
build(nix): allow overriding TARGET_CPU
This commit is contained in:
@@ -9,6 +9,7 @@
|
|||||||
rustPlatform,
|
rustPlatform,
|
||||||
cargoExtraArgs ? "",
|
cargoExtraArgs ? "",
|
||||||
rustflags ? "",
|
rustflags ? "",
|
||||||
|
target_cpu ? null,
|
||||||
rocksdb ? callPackage ./rocksdb.nix { },
|
rocksdb ? callPackage ./rocksdb.nix { },
|
||||||
profile ? "release",
|
profile ? "release",
|
||||||
}:
|
}:
|
||||||
@@ -39,7 +40,10 @@ let
|
|||||||
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
||||||
CARGO_PROFILE = profile;
|
CARGO_PROFILE = profile;
|
||||||
RUSTFLAGS = rustflags;
|
RUSTFLAGS = rustflags;
|
||||||
};
|
}
|
||||||
|
// (lib.optionalAttrs (target_cpu != null) {
|
||||||
|
TARGET_CPU = target_cpu;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
craneLib.buildPackage (
|
craneLib.buildPackage (
|
||||||
|
|||||||
@@ -22,11 +22,13 @@
|
|||||||
rustflags = "--cfg reqwest_unstable";
|
rustflags = "--cfg reqwest_unstable";
|
||||||
};
|
};
|
||||||
# users may also override this with other cargo profiles to build for other feature sets
|
# users may also override this with other cargo profiles to build for other feature sets
|
||||||
#
|
# for features configuration see `default` package which enables http3 by default
|
||||||
# other examples include:
|
|
||||||
#
|
# example: different compilation profile and different target_cpu
|
||||||
# - release-high-perf
|
max-perf-haswell = self'.packages.default.override {
|
||||||
max-perf = self'.packages.default.override {
|
# compiles explicitly for haswell arch cpus
|
||||||
|
target_cpu = "haswell";
|
||||||
|
# compiles slower but with more thorough optimizations
|
||||||
profile = "release-max-perf";
|
profile = "release-max-perf";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user