1{ lib, stdenv, fetchFromGitHub, rustPlatform, pkg-config, libusb1, AppKit }:
2
3rustPlatform.buildRustPackage rec {
4 pname = "ecpdap";
5 version = "0.1.8";
6
7 src = fetchFromGitHub {
8 owner = "adamgreig";
9 repo = pname;
10 rev = "v${version}";
11 sha256 = "sha256-KXfEQnbhUUKsCDKhPBjwjF9eJMuiCx5o7gOSzyWv36s=";
12 };
13
14 cargoSha256 = "sha256-BEfsNSzrdV/tnzWk4oOwchOupW6PzZ8TEx7zUzwLBV8=";
15
16 nativeBuildInputs = [ pkg-config ];
17
18 buildInputs = [ libusb1 ]
19 ++ lib.optional stdenv.isDarwin AppKit;
20
21 postInstall = ''
22 mkdir -p $out/etc/udev/rules.d
23 cp drivers/*.rules $out/etc/udev/rules.d
24 '';
25
26 meta = with lib; {
27 description = "A tool to program ECP5 FPGAs";
28 longDescription = ''
29 ECPDAP allows you to program ECP5 FPGAs and attached SPI flash
30 using CMSIS-DAP probes in JTAG mode.
31 '';
32 homepage = "https://github.com/adamgreig/ecpdap";
33 license = licenses.asl20;
34 maintainers = with maintainers; [ expipiplus1 ];
35 };
36}
37