add xbuild

This commit is contained in:
Lize Live
2024-10-17 15:00:34 -07:00
parent aea1cc66cd
commit 64891836f8
4 changed files with 4570 additions and 23 deletions

56
xbuild/default.nix Normal file
View File

@@ -0,0 +1,56 @@
{ lib
, rustPlatform
, fetchFromGitHub
, pkg-config
, bzip2
, xz
, zstd
, stdenv
, darwin
,
}:
rustPlatform.buildRustPackage rec {
pname = "xbuild";
version = "0.2.0";
src = fetchFromGitHub {
owner = "rust-mobile";
repo = "xbuild";
rev = "ffe3e34af6a34decd98222057b140b0fafb1b07a";
hash = "sha256-60XHUkwGyTlold5/gNlbF3GIoe6nQMot9Twlt1+VSGA=";
};
cargoLock = {
lockFile = ./Cargo.lock;
};
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
nativeBuildInputs = [
pkg-config
];
buildInputs = [
bzip2
xz
zstd
] ++ lib.optionals stdenv.isDarwin [
darwin.apple_sdk.frameworks.Security
darwin.apple_sdk.frameworks.SystemConfiguration
];
env = {
ZSTD_SYS_USE_PKG_CONFIG = true;
};
meta = {
description = "Cross compile rust to any platform";
homepage = "https://github.com/rust-mobile/xbuild.git";
license = [ lib.licenses.mit lib.licenses.asl20 ];
maintainers = with lib.maintainers; [ ];
mainProgram = "xbuild";
};
}