lol
1{ stdenv, fetchurl, cmake, libusb1 }:
2
3# IMPORTANT: You need permissions to access the stlink usb devices.
4# Add services.udev.pkgs = [ pkgs.stlink ] to your configuration.nix
5
6let
7 version = "1.3.0";
8in
9stdenv.mkDerivation {
10 name = "stlink-${version}";
11
12 src = fetchurl {
13 url = "https://github.com/texane/stlink/archive/${version}.tar.gz";
14 sha256 = "3e8cba21744d2c38a0557f6835a05189e1b98202931bb0183d22efc462c893dd";
15 };
16
17 buildInputs = [ cmake libusb1 ];
18 patchPhase = ''
19 sed -i 's@/etc/udev/rules.d@$ENV{out}/etc/udev/rules.d@' CMakeLists.txt
20 sed -i 's@/etc/modprobe.d@$ENV{out}/etc/modprobe.d@' CMakeLists.txt
21 '';
22 preInstall = ''
23 mkdir -p $out/etc/udev/rules.d
24 mkdir -p $out/etc/modprobe.d
25 '';
26
27 meta = with stdenv.lib; {
28 description = "In-circuit debug and programming for ST-Link devices";
29 license = licenses.bsd3;
30 platforms = platforms.linux;
31 maintainers = [ maintainers.bjornfor maintainers.rongcuid ];
32 };
33}