about summary refs log tree commit diff
path: root/pkgs/development/tools/espup
diff options
context:
space:
mode:
authorDanylo Kondratiev2023-07-29 21:21:23 +0300
committerDanylo Kondratiev2023-07-31 13:53:13 +0300
commit79e370f220bfa77cb6e818500876038ab00666a2 (patch)
treeedc28837bcb608033f32d04c1b17d5e5ef7dd2e2 /pkgs/development/tools/espup
parentd8bdf59f62dc0e2fe277007effa855ddac896e31 (diff)
espup: init at 0.4.1
Diffstat (limited to 'pkgs/development/tools/espup')
-rw-r--r--pkgs/development/tools/espup/default.nix82
1 files changed, 82 insertions, 0 deletions
diff --git a/pkgs/development/tools/espup/default.nix b/pkgs/development/tools/espup/default.nix
new file mode 100644
index 000000000000..6ff3a2972a46
--- /dev/null
+++ b/pkgs/development/tools/espup/default.nix
@@ -0,0 +1,82 @@
+{ lib
+, rustPlatform
+, fetchFromGitHub
+, pkg-config
+, installShellFiles
+, bzip2
+, openssl
+, xz
+, zstd
+, stdenv
+, darwin
+, runCommand
+, espup
+}:
+
+rustPlatform.buildRustPackage rec {
+  pname = "espup";
+  version = "0.4.1";
+
+  src = fetchFromGitHub {
+    owner = "esp-rs";
+    repo = "espup";
+    rev = "v${version}";
+    hash = "sha256-gzM+RT4Rt+LaYk7CwYUTIMci8DDI0y3+7y+N2yKRDOc=";
+  };
+
+  cargoHash = "sha256-GYhF6VDBAieZbu4x9EiQVVJkmx0aRYK0xwGGP0nuVGc=";
+
+  nativeBuildInputs = [
+    pkg-config
+    installShellFiles
+  ];
+
+  buildInputs = [
+    bzip2
+    openssl
+    xz
+    zstd
+  ] ++ lib.optionals stdenv.isDarwin [
+    darwin.apple_sdk.frameworks.CoreFoundation
+    darwin.apple_sdk.frameworks.Security
+  ];
+
+  env = {
+    OPENSSL_NO_VENDOR = true;
+    ZSTD_SYS_USE_PKG_CONFIG = true;
+  };
+
+  preCheck = ''
+    export HOME=$(mktemp -d)
+  '';
+
+  checkFlags = [
+    # makes network calls
+    "--skip=toolchain::rust::tests::test_xtensa_rust_parse_version"
+  ];
+
+  postInstall = ''
+    installShellCompletion --cmd espup \
+      --bash <($out/bin/espup completions bash) \
+      --fish <($out/bin/espup completions fish) \
+      --zsh <($out/bin/espup completions zsh)
+  '';
+
+  passthru.tests = {
+    simple = runCommand "${pname}-test" { } ''
+      if [[ `${espup}/bin/espup --version` != *"${version}"*  ]]; then
+        echo "Error: program version does not match package version"
+        exit 1
+      fi
+
+      touch $out
+    '';
+  };
+
+  meta = with lib; {
+    description = "Tool for installing and maintaining Espressif Rust ecosystem.";
+    homepage = "https://github.com/esp-rs/espup/";
+    license = with licenses; [ mit asl20 ];
+    maintainers = with maintainers; [ knightpp ];
+  };
+}