nix: naersk/fenix -> rustPlatform/rust-overlay

This commit is contained in:
seth 2024-03-24 15:08:45 -04:00
parent 6bd5db7208
commit 3c4cf67bbf
No known key found for this signature in database
GPG key ID: D31BD0D494BBEE86
9 changed files with 164 additions and 242 deletions

View file

@ -1,14 +1,18 @@
{
lib,
stdenv,
naersk,
rustPlatform,
darwin,
version,
self,
lto ? false,
}:
naersk.buildPackage {
rustPlatform.buildRustPackage {
pname = "refraction";
inherit version;
version =
(lib.importTOML ../Cargo.toml).package.version
+ "-${self.shortRev or self.dirtyShortRev or "unknown-dirty"}";
__structuredAttrs = true;
src = lib.fileset.toSource {
root = ../.;
@ -21,13 +25,21 @@ naersk.buildPackage {
];
};
cargoLock = {
lockFile = ../Cargo.lock;
};
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
CoreFoundation
Security
SystemConfiguration
]);
cargoBuildFlags = lib.optionals lto ["-C" "lto=thin" "-C" "embed-bitcode=yes" "-Zdylib-lto"];
env = {
CARGO_BUILD_RUSTFLAGS = lib.concatStringsSep " " (
lib.optionals lto ["-C" "lto=thin" "-C" "embed-bitcode=yes" "-Zdylib-lto"]
);
};
meta = with lib; {
mainProgram = "refraction";