Files
sta/nix/backend.nix

25 lines
702 B
Nix
Raw Normal View History

target: let
cargoToml = fromTOML (builtins.readFile ../backend/Cargo.toml);
inherit (cargoToml.package) name version;
pkgs = target.crossPkgs;
buildArgs = {
pname = name;
inherit version;
src = pkgs.lib.cleanSource ../.;
cargoLock.lockFile = ../Cargo.lock;
useNextest = true;
meta = {
inherit (cargoToml.package) description homepage;
};
postBuild = "${pkgs.upx}/bin/upx target/*/release/*${name}";
};
rustVersion = pkgs.rust-bin.stable.latest.default.override {
targets = [target.triple];
};
rustPlatform = target.crossPkgs.makeRustPlatform {
cargo = rustVersion;
rustc = rustVersion;
};
in
rustPlatform.buildRustPackage buildArgs