traefik: add djds as maintainer (#377217)
[NixPkgs.git] / pkgs / by-name / st / stm32cubemx / package.nix
blob66b1f8a3f8c54ebecf54cdf2e8c77b62324889c3
2   fdupes,
3   buildFHSEnv,
4   fetchzip,
5   icoutils,
6   imagemagick,
7   jdk21,
8   lib,
9   makeDesktopItem,
10   stdenvNoCC,
13 let
14   iconame = "STM32CubeMX";
15   package = stdenvNoCC.mkDerivation rec {
16     pname = "stm32cubemx";
17     version = "6.13.0";
19     src = fetchzip {
20       url = "https://sw-center.st.com/packs/resource/library/stm32cube_mx_v${
21         builtins.replaceStrings [ "." ] [ "" ] version
22       }-lin.zip";
23       hash = "sha256-ypZVVPmAsApaccWl7ZtAECwphD2SUUiVNC2DYC5rYb4=";
24       stripRoot = false;
25     };
27     nativeBuildInputs = [
28       fdupes
29       icoutils
30       imagemagick
31     ];
32     desktopItem = makeDesktopItem {
33       name = "STM32CubeMX";
34       exec = "stm32cubemx";
35       desktopName = "STM32CubeMX";
36       categories = [ "Development" ];
37       icon = "stm32cubemx";
38       comment = meta.description;
39       terminal = false;
40       startupNotify = false;
41       mimeTypes = [
42         "x-scheme-handler/sgnl"
43         "x-scheme-handler/signalcaptcha"
44       ];
45     };
47     buildCommand = ''
48       mkdir -p $out/{bin,opt/STM32CubeMX,share/applications}
50       cp -r $src/MX/. $out/opt/STM32CubeMX/
51       chmod +rx $out/opt/STM32CubeMX/STM32CubeMX
53       cat << EOF > $out/bin/${pname}
54       #!${stdenvNoCC.shell}
55       ${jdk21}/bin/java -jar $out/opt/STM32CubeMX/STM32CubeMX "\$@"
56       EOF
57       chmod +x $out/bin/${pname}
59       icotool --extract $out/opt/STM32CubeMX/help/${iconame}.ico
60       fdupes -dN . > /dev/null
61       ls
62       for size in 16 24 32 48 64 128 256; do
63         mkdir -pv $out/share/icons/hicolor/"$size"x"$size"/apps
64         if [ $size -eq 256 ]; then
65           mv ${iconame}_*_"$size"x"$size"x32.png \
66             $out/share/icons/hicolor/"$size"x"$size"/apps/${pname}.png
67         else
68           convert -resize "$size"x"$size" ${iconame}_*_256x256x32.png \
69             $out/share/icons/hicolor/"$size"x"$size"/apps/${pname}.png
70         fi
71       done;
73       cp ${desktopItem}/share/applications/*.desktop $out/share/applications
74     '';
76     meta = with lib; {
77       description = "A graphical tool for configuring STM32 microcontrollers and microprocessors";
78       longDescription = ''
79         A graphical tool that allows a very easy configuration of STM32
80         microcontrollers and microprocessors, as well as the generation of the
81         corresponding initialization C code for the Arm® Cortex®-M core or a
82         partial Linux® Device Tree for Arm® Cortex®-A core), through a
83         step-by-step process.
84       '';
85       homepage = "https://www.st.com/en/development-tools/stm32cubemx.html";
86       sourceProvenance = with sourceTypes; [ binaryBytecode ];
87       license = licenses.unfree;
88       maintainers = with maintainers; [
89         angaz
90         wucke13
91       ];
92       platforms = [ "x86_64-linux" ];
93     };
94   };
96 buildFHSEnv {
97   inherit (package) pname version meta;
98   runScript = "${package.outPath}/bin/stm32cubemx";
99   targetPkgs =
100     pkgs: with pkgs; [
101       alsa-lib
102       at-spi2-atk
103       cairo
104       cups
105       dbus
106       expat
107       glib
108       gtk3
109       libdrm
110       libGL
111       libudev0-shim
112       libxkbcommon
113       libgbm
114       nspr
115       nss
116       pango
117       xorg.libX11
118       xorg.libxcb
119       xorg.libXcomposite
120       xorg.libXdamage
121       xorg.libXext
122       xorg.libXfixes
123       xorg.libXrandr
124     ];