dotfiles/nix/rust.nix

26 lines
687 B
Nix
Raw Normal View History

{ pkgs
, crane
, buildTarget ? "x86_64-unknown-linux-musl"
}:
let
craneLib = (crane.mkLib pkgs).overrideToolchain pkgs.rustToolchain;
2023-10-12 13:40:38 +00:00
nativeBuildInputs = [ pkgs.protobuf ];
src = pkgs.lib.cleanSourceWith {
src = craneLib.path ../.;
filter = path: type:
(craneLib.filterCargoSources path type) ||
(builtins.match ".*proto$" path != null);
};
in
craneLib.buildPackage {
2023-10-12 13:40:38 +00:00
inherit src nativeBuildInputs;
2023-10-12 13:40:38 +00:00
pname = "prymn_agent";
version = "0.1.0";
doCheck = false; # FIXME: Tests need to run on the native architecture
strictDeps = true;
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static -C linker=rust-lld";
CARGO_BUILD_TARGET = buildTarget;
}