Files
jj-cz/nix/package.nix
T

28 lines
728 B
Nix
Raw Normal View History

2026-02-05 16:25:14 +01:00
{
target,
2026-03-08 15:44:26 +01:00
pkgs,
2026-02-05 16:25:14 +01:00
}: let
cargoToml = fromTOML (builtins.readFile ../Cargo.toml);
name = cargoToml.package.name;
version = cargoToml.package.version;
2026-03-25 18:46:26 +01:00
buildArgs = {
2026-02-05 16:25:14 +01:00
pname = name;
inherit version;
2026-03-08 15:44:26 +01:00
src = pkgs.lib.cleanSource ../.;
2026-02-05 16:25:14 +01:00
cargoLock.lockFile = ../Cargo.lock;
2026-03-08 15:44:26 +01:00
useNextest = true;
meta = {
2026-03-25 18:46:26 +01:00
inherit (cargoToml.package) description homepage;
2026-03-08 15:44:26 +01:00
};
postBuild = "${pkgs.upx}/bin/upx target/*/release/${name}${target.exeSuffix}";
2026-02-05 16:25:14 +01:00
};
rustVersion = pkgs.rust-bin.stable.latest.default.override {
targets = [target.triple];
};
rustPlatform = target.crossPkgs.makeRustPlatform {
cargo = rustVersion;
rustc = rustVersion;
};
in
rustPlatform.buildRustPackage buildArgs