13 # The Darwin build of stlink explicitly refers to static libusb.
14 libusb1' = if stdenv.isDarwin then libusb1.override { withStatic = true; } else libusb1;
16 # IMPORTANT: You need permissions to access the stlink usb devices.
17 # Add services.udev.packages = [ pkgs.stlink ] to your configuration.nix
19 in stdenv.mkDerivation rec {
23 src = fetchFromGitHub {
27 sha256 = "sha256-hlFI2xpZ4ldMcxZbg/T5/4JuFFdO9THLcU0DQKSFqrw=";
32 ] ++ lib.optionals withGUI [
37 ] ++ lib.optionals withGUI [
43 "-DSTLINK_MODPROBED_DIR=${placeholder "out"}/etc/modprobe.d"
44 "-DSTLINK_UDEV_RULES_DIR=${placeholder "out"}/lib/udev/rules.d"
48 description = "In-circuit debug and programming for ST-Link devices";
49 license = licenses.bsd3;
50 platforms = platforms.unix;
51 badPlatforms = platforms.darwin;
52 maintainers = [ maintainers.bjornfor maintainers.rongcuid ];