2017-02-12 02:44:29 +00:00
|
|
|
{ stdenv, fetchurl, 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
|
2017-02-12 02:44:29 +00:00
|
|
|
version = "1.3.0";
|
2015-04-23 23:07:29 +01:00
|
|
|
in
|
2013-02-23 11:05:22 +00:00
|
|
|
stdenv.mkDerivation {
|
2015-04-23 23:07:29 +01:00
|
|
|
name = "stlink-${version}";
|
2013-02-23 11:05:22 +00:00
|
|
|
|
2015-04-23 23:07:29 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/texane/stlink/archive/${version}.tar.gz";
|
2017-02-12 02:44:29 +00:00
|
|
|
sha256 = "3e8cba21744d2c38a0557f6835a05189e1b98202931bb0183d22efc462c893dd";
|
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;
|
|
|
|
platforms = platforms.linux;
|
2017-02-12 02:44:29 +00:00
|
|
|
maintainers = [ maintainers.bjornfor maintainers.rongcuid ];
|
2013-02-23 11:05:22 +00:00
|
|
|
};
|
|
|
|
}
|