about summary refs log tree commit diff
path: root/pkgs/by-name/st/stlink-tool/package.nix
blob: 029bb0a9b25acfdf6ff0ec23693a8498f34b1d70 (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
34
35
36
37
38
39
40
41
{ lib
, stdenv
, pkg-config
, fetchFromGitHub
, libusb1
}:

# IMPORTANT: You need permissions to access the stlink usb devices.
# Add services.udev.packages = [ pkgs.stlink ] to your configuration.nix
stdenv.mkDerivation {
  pname = "stlink-tool";
  version = "0-unstable-2020-06-10";

  src = fetchFromGitHub {
    owner = "jeanthom";
    repo = "stlink-tool";
    rev = "8cbdffee012d5a782dd67d1277ed22fa889b9ba9";
    hash = "sha256-1Mk4rFyIviJ9hcJo1GyzRmlPIemBJtuj3PgvnNhche0=";
    fetchSubmodules = true;
  };

  buildInputs = [ libusb1 ];
  nativeBuildInputs = [ pkg-config ];

  env.NIX_CFLAGS_COMPILE = "-Wno-uninitialized";

  installPhase = ''
    runHook preInstall
    install -D stlink-tool $out/bin/stlink-tool
    runHook postInstall
  '';

  meta = with lib; {
    description = "libusb tool for flashing chinese ST-Link dongles";
    homepage = "https://github.com/jeanthom/stlink-tool";
    license = licenses.mit;
    platforms = platforms.unix;
    maintainers = [ maintainers.wucke13 ];
    mainProgram = "stlink-tool";
  };
}