1{ lib
2, rustPlatform
3, fetchFromGitHub
4, pkg-config
5, installShellFiles
6, bzip2
7, openssl
8, xz
9, zstd
10, stdenv
11, darwin
12, testers
13, espup
14}:
15
16rustPlatform.buildRustPackage rec {
17 pname = "espup";
18 version = "0.11.0";
19
20 src = fetchFromGitHub {
21 owner = "esp-rs";
22 repo = "espup";
23 rev = "v${version}";
24 hash = "sha256-BW71yFX4jfx90KHdynkGSqWD4diyjEBQfdBNquVdDDI=";
25 };
26
27 cargoHash = "sha256-iUVOU1P996hLC1rR/wWtsDBkKSB0rD7PPh6ZsQkHq3I=";
28
29 nativeBuildInputs = [
30 pkg-config
31 installShellFiles
32 ];
33
34 buildInputs = [
35 bzip2
36 openssl
37 xz
38 zstd
39 ] ++ lib.optionals stdenv.isDarwin [
40 darwin.apple_sdk.frameworks.CoreFoundation
41 darwin.apple_sdk.frameworks.Security
42 darwin.apple_sdk.frameworks.SystemConfiguration
43 ];
44
45 env = {
46 OPENSSL_NO_VENDOR = true;
47 ZSTD_SYS_USE_PKG_CONFIG = true;
48 };
49
50 preCheck = ''
51 export HOME=$(mktemp -d)
52 '';
53
54 checkFlags = [
55 # makes network calls
56 "--skip=toolchain::rust::tests::test_xtensa_rust_parse_version"
57 ];
58
59 postInstall = ''
60 installShellCompletion --cmd espup \
61 --bash <($out/bin/espup completions bash) \
62 --fish <($out/bin/espup completions fish) \
63 --zsh <($out/bin/espup completions zsh)
64 '';
65
66 passthru.tests.version = testers.testVersion {
67 package = espup;
68 };
69
70 meta = with lib; {
71 description = "Tool for installing and maintaining Espressif Rust ecosystem.";
72 homepage = "https://github.com/esp-rs/espup/";
73 license = with licenses; [ mit asl20 ];
74 maintainers = with maintainers; [ knightpp beeb ];
75 mainProgram = "espup";
76 };
77}