about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/espup/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/espup/default.nix')
-rw-r--r--nixpkgs/pkgs/development/tools/espup/default.nix82
1 files changed, 82 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/espup/default.nix b/nixpkgs/pkgs/development/tools/espup/default.nix
new file mode 100644
index 000000000000..f71ef18487f1
--- /dev/null
+++ b/nixpkgs/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.5.0";
+
+  src = fetchFromGitHub {
+    owner = "esp-rs";
+    repo = "espup";
+    rev = "v${version}";
+    hash = "sha256-Eb0Q+Ju5nTXL0XvNhAo4Mc+ZP/vOfld313H9/oI3I2U=";
+  };
+
+  cargoHash = "sha256-ZKku6ElEtYXxwqeWTDKcCuZ4Wgqonc0B9nMyNd0VcdU=";
+
+  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 ];
+  };
+}