nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, stdenv
3, rustPlatform
4, fetchFromGitHub
5, pkg-config
6, openssl
7, git
8, darwin
9, makeWrapper
10}:
11
12let
13 inherit (darwin.apple_sdk.frameworks) CoreServices;
14 pname = "tauri-mobile";
15 version = "unstable-2023-04-25";
16in
17rustPlatform.buildRustPackage {
18 inherit pname version;
19 src = fetchFromGitHub {
20 owner = "tauri-apps";
21 repo = pname;
22 rev = "c2abaf54135bf65b1165a38d3b1d84e8d57f5d6c";
23 sha256 = "sha256-WHyiswe64tkNhhgmHquv9YPLQAU1yTJ/KglTqEPBcOM=";
24 };
25
26 # Manually specify the sourceRoot since this crate depends on other crates in the workspace. Relevant info at
27 # https://discourse.nixos.org/t/difficulty-using-buildrustpackage-with-a-src-containing-multiple-cargo-workspaces/10202
28 # sourceRoot = "source/tooling/cli";
29
30 cargoHash = "sha256-Kc1BikwUYSpPShRtAPbHCdfVzo6zwjiO3QeqRkO+WhY=";
31
32 preBuild = ''
33 export HOME=$(mktemp -d)
34 '';
35
36 buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ CoreServices ];
37 nativeBuildInputs = [ pkg-config git makeWrapper ];
38
39 preInstall = ''
40 mkdir -p $out/share/
41 # the directory created in the build process is .tauri-mobile, a hidden directory
42 shopt -s dotglob
43 for temp_dir in $HOME/*; do
44 cp -R $temp_dir $out/share
45 done
46 '';
47
48 meta = with lib; {
49 description = "Rust on mobile made easy! ";
50 homepage = "https://tauri.app/";
51 license = with licenses; [ asl20 /* or */ mit ];
52 maintainers = with maintainers; [ happysalada ];
53 };
54}