2019-08-05 16:58:22 +01:00
|
|
|
{ stdenv, fetchFromGitHub, cmake, libusb1 }:
|
2013-02-23 11:05:22 +00:00
|
|
|
|
2017-02-12 02:44:29 +00:00
|
|
|
# IMPORTANT: You need permissions to access the stlink usb devices.
|
|
|
|
# Add services.udev.pkgs = [ pkgs.stlink ] to your configuration.nix
|
2013-02-23 11:05:22 +00:00
|
|
|
|
2015-04-23 23:07:29 +01:00
|
|
|
let
|
2019-08-05 16:58:22 +01:00
|
|
|
version = "1.5.1";
|
2015-04-23 23:07:29 +01:00
|
|
|
in
|
2013-02-23 11:05:22 +00:00
|
|
|
stdenv.mkDerivation {
|
2019-08-13 22:52:01 +01:00
|
|
|
pname = "stlink";
|
|
|
|
inherit version;
|
2013-02-23 11:05:22 +00:00
|
|
|
|
2019-08-05 16:58:22 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "texane";
|
|
|
|
repo = "stlink";
|
|
|
|
rev = "v1.5.1";
|
|
|
|
sha256 = "1d5gxiqpsm8fc105cxlp27af9fk339fap5h6nay21x5a7n61jgyc";
|
2013-02-23 11:05:22 +00:00
|
|
|
};
|
|
|
|
|
2017-02-12 02:44:29 +00:00
|
|
|
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
|
|
|
|
'';
|
2013-02-23 11:05:22 +00:00
|
|
|
|
2013-05-20 18:33:18 +01:00
|
|
|
meta = with stdenv.lib; {
|
2013-02-23 11:05:22 +00:00
|
|
|
description = "In-circuit debug and programming for ST-Link devices";
|
2013-05-20 18:33:18 +01:00
|
|
|
license = licenses.bsd3;
|
2019-05-01 17:15:33 +01:00
|
|
|
platforms = platforms.unix;
|
2017-02-12 02:44:29 +00:00
|
|
|
maintainers = [ maintainers.bjornfor maintainers.rongcuid ];
|
2013-02-23 11:05:22 +00:00
|
|
|
};
|
|
|
|
}
|