2023-07-10 01:06:52 +02:00
|
|
|
{
|
|
|
|
lib
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
2024-02-12 13:14:57 +01:00
|
|
|
, installShellFiles
|
2023-07-10 01:06:52 +02:00
|
|
|
, udev
|
|
|
|
, stdenv
|
2024-03-28 12:04:37 +01:00
|
|
|
, CoreServices
|
2023-07-10 01:06:52 +02:00
|
|
|
, Security
|
|
|
|
, nix-update-script
|
|
|
|
, openssl
|
|
|
|
, SystemConfiguration
|
|
|
|
}:
|
2022-09-16 16:02:09 +02:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
2024-02-09 17:50:17 +01:00
|
|
|
pname = "espflash";
|
2024-03-13 13:17:30 +01:00
|
|
|
version = "3.0.0";
|
2022-09-16 16:02:09 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "esp-rs";
|
|
|
|
repo = "espflash";
|
|
|
|
rev = "v${version}";
|
2024-03-13 13:17:30 +01:00
|
|
|
hash = "sha256-0CnYdz1KG/y4B+dOp9rYE097ctf4GNmyqv3/xywdA6A=";
|
2022-09-16 16:02:09 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
2024-02-12 13:14:57 +01:00
|
|
|
installShellFiles
|
2022-09-16 16:02:09 +02:00
|
|
|
];
|
|
|
|
|
2023-07-10 01:06:52 +02:00
|
|
|
# Needed to get openssl-sys to use pkg-config.
|
|
|
|
OPENSSL_NO_VENDOR = 1;
|
|
|
|
|
|
|
|
buildInputs = [ openssl ] ++ lib.optionals stdenv.isLinux [
|
2022-09-16 16:02:09 +02:00
|
|
|
udev
|
2022-10-16 02:28:50 +02:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
2024-03-28 12:04:37 +01:00
|
|
|
CoreServices
|
2022-10-16 02:28:50 +02:00
|
|
|
Security
|
2023-07-10 01:06:52 +02:00
|
|
|
SystemConfiguration
|
2022-09-16 16:02:09 +02:00
|
|
|
];
|
|
|
|
|
2024-03-13 13:17:30 +01:00
|
|
|
cargoHash = "sha256-CmhBl+d5odc0QL45aWCJcBZIVeJsdpxJweh7FT8cpyY=";
|
2023-07-10 01:06:52 +02:00
|
|
|
|
2024-02-12 13:14:57 +01:00
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
|
|
installShellCompletion --cmd espflash \
|
|
|
|
--bash <($out/bin/espflash completions bash) \
|
|
|
|
--zsh <($out/bin/espflash completions zsh) \
|
|
|
|
--fish <($out/bin/espflash completions fish)
|
|
|
|
'';
|
|
|
|
|
2023-07-10 01:06:52 +02:00
|
|
|
passthru.updateScript = nix-update-script { };
|
2022-09-16 16:02:09 +02:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Serial flasher utility for Espressif SoCs and modules based on esptool.py";
|
2024-02-09 17:50:17 +01:00
|
|
|
homepage = "https://github.com/esp-rs/espflash";
|
|
|
|
changelog = "https://github.com/esp-rs/espflash/blob/v${version}/CHANGELOG.md";
|
|
|
|
mainProgram = "espflash";
|
2022-09-19 14:31:30 +02:00
|
|
|
license = with licenses; [ mit /* or */ asl20 ];
|
2022-09-16 16:02:09 +02:00
|
|
|
maintainers = with maintainers; [ matthiasbeyer ];
|
|
|
|
};
|
|
|
|
}
|