2023-04-29 16:46:19 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, openssl
|
|
|
|
, git
|
|
|
|
, darwin
|
|
|
|
, makeWrapper
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
inherit (darwin.apple_sdk.frameworks) CoreServices;
|
2023-10-19 13:55:26 +00:00
|
|
|
pname = "cargo-mobile2";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "0.9.1";
|
2023-04-29 16:46:19 +00:00
|
|
|
in
|
|
|
|
rustPlatform.buildRustPackage {
|
|
|
|
inherit pname version;
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tauri-apps";
|
|
|
|
repo = pname;
|
2023-10-19 13:55:26 +00:00
|
|
|
rev = "cargo-mobile2-v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-gyTA85eLVvDQKWo7D2zO6zFC8910AyNasXGjR1qkI6c=";
|
2023-04-29 16:46:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Manually specify the sourceRoot since this crate depends on other crates in the workspace. Relevant info at
|
|
|
|
# https://discourse.nixos.org/t/difficulty-using-buildrustpackage-with-a-src-containing-multiple-cargo-workspaces/10202
|
2023-08-04 22:07:22 +00:00
|
|
|
# sourceRoot = "${src.name}/tooling/cli";
|
2023-04-29 16:46:19 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
cargoHash = "sha256-Zcs+Sm2+xd7OSPXv+QDd7Jh8YvlmVrhWotjVNMqyE60=";
|
2023-04-29 16:46:19 +00:00
|
|
|
|
|
|
|
preBuild = ''
|
2023-07-15 17:15:38 +00:00
|
|
|
mkdir -p $out/share/
|
|
|
|
# during the install process tauri-mobile puts templates and commit information in CARGO_HOME
|
|
|
|
export CARGO_HOME=$out/share/
|
2023-04-29 16:46:19 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ CoreServices ];
|
|
|
|
nativeBuildInputs = [ pkg-config git makeWrapper ];
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
preFixup = ''
|
|
|
|
for bin in $out/bin/cargo-*; do
|
|
|
|
wrapProgram $bin \
|
|
|
|
--set CARGO_HOME "$out/share"
|
2023-04-29 16:46:19 +00:00
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Rust on mobile made easy! ";
|
|
|
|
homepage = "https://tauri.app/";
|
|
|
|
license = with licenses; [ asl20 /* or */ mit ];
|
|
|
|
maintainers = with maintainers; [ happysalada ];
|
|
|
|
};
|
|
|
|
}
|