summary refs log tree commit diff
path: root/pkgs/development/tools/misc/stlink/default.nix
blob: c59847b1e0f747bf59b868950aadb0561b052f69 (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
{ stdenv, fetchFromGitHub, cmake, libusb1 }:

# IMPORTANT: You need permissions to access the stlink usb devices. 
# Add services.udev.pkgs = [ pkgs.stlink ] to your configuration.nix

stdenv.mkDerivation rec {
  pname = "stlink";
  version = "1.6.0";

  src = fetchFromGitHub {
    owner = "texane";
    repo = "stlink";
    rev = "v${version}";
    sha256 = "1mlkrxjxg538335g59hjb0zc739dx4mhbspb26z5gz3lf7d4xv6x";
  };

  buildInputs = [ cmake libusb1 ];
  patchPhase = ''
    sed -i 's@/etc/udev/rules.d@$ENV{out}/etc/udev/rules.d@' CMakeLists.txt
    sed -i 's@/etc/modprobe.d@$ENV{out}/etc/modprobe.d@' CMakeLists.txt
  '';
  preInstall = ''
    mkdir -p $out/etc/udev/rules.d
    mkdir -p $out/etc/modprobe.d
  '';

  meta = with stdenv.lib; {
    description = "In-circuit debug and programming for ST-Link devices";
    license = licenses.bsd3;
    platforms = platforms.unix;
    maintainers = [ maintainers.bjornfor maintainers.rongcuid ];
  };
}