about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/embedded/fpga/ecpdap/default.nix
blob: 799915b1b7f68c6ad2987b290dbce1937962c4a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{ lib, stdenv, fetchFromGitHub, rustPlatform, pkg-config, libusb1, AppKit }:

rustPlatform.buildRustPackage rec {
  pname = "ecpdap";
  version = "0.1.8";

  src = fetchFromGitHub {
    owner = "adamgreig";
    repo = pname;
    rev = "v${version}";
    sha256 = "sha256-KXfEQnbhUUKsCDKhPBjwjF9eJMuiCx5o7gOSzyWv36s=";
  };

  cargoSha256 = "sha256-BEfsNSzrdV/tnzWk4oOwchOupW6PzZ8TEx7zUzwLBV8=";

  nativeBuildInputs = [ pkg-config ];

  buildInputs = [ libusb1 ]
    ++ lib.optional stdenv.isDarwin AppKit;

  postInstall = ''
    mkdir -p $out/etc/udev/rules.d
    cp drivers/*.rules $out/etc/udev/rules.d
  '';

  meta = with lib; {
    description = "A tool to program ECP5 FPGAs";
    longDescription = ''
      ECPDAP allows you to program ECP5 FPGAs and attached SPI flash
      using CMSIS-DAP probes in JTAG mode.
    '';
    homepage = "https://github.com/adamgreig/ecpdap";
    license = licenses.asl20;
    maintainers = with maintainers; [ expipiplus1 ];
  };
}