about summary refs log tree commit diff
path: root/pkgs/applications/science/robotics/betaflight-configurator/default.nix
blob: 6449e966959b8dcc93ca906423a7117173c7524c (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
42
43
44
45
46
47
48
49
50
{stdenv, fetchurl, unzip, makeDesktopItem, nwjs, wrapGAppsHook, gsettings-desktop-schemas, gtk3 }:

let
  strippedName = "betaflight-configurator";
  desktopItem = makeDesktopItem {
    name = strippedName;
    exec = strippedName;
    icon = "${strippedName}-icon.png";
    comment = "Betaflight configuration tool";
    desktopName = "Betaflight Configurator";
    genericName = "Flight controller configuration tool";
  };
in
stdenv.mkDerivation rec {
  name = "${strippedName}-${version}";
  version = "10.5.1";
  src = fetchurl {
    url = "https://github.com/betaflight/betaflight-configurator/releases/download/${version}/${strippedName}_${version}_linux64.zip";
    sha256 = "1l4blqgaqfrnydk05q6pwdqdhcly2f8nwzrv0749cqmfiinh8ygc";
  };

  nativeBuildInputs = [ wrapGAppsHook ];
  
  buildInputs = [ unzip gsettings-desktop-schemas gtk3 ];
  
  installPhase = ''
    mkdir -p $out/bin \
             $out/opt/${strippedName} \
             $out/share/icons

    cp -r . $out/opt/${strippedName}/
    cp icon/*_icon_128.png $out/share/icons/${strippedName}-icon.png
    cp -r ${desktopItem}/share/applications $out/share/

    makeWrapper ${nwjs}/bin/nw $out/bin/${strippedName} --add-flags $out/opt/${strippedName}
  '';

  meta = with stdenv.lib; {
    description = "The Betaflight flight control system configuration tool";
    longDescription = ''
      A crossplatform configuration tool for the Betaflight flight control system.
      Various types of aircraft are supported by the tool and by Betaflight, e.g. 
      quadcopters, hexacopters, octocopters and fixed-wing aircraft.
    '';
    homepage    = https://github.com/betaflight/betaflight/wiki;
    license     = licenses.gpl3;
    maintainers = with maintainers; [ wucke13 ];
    platforms   = platforms.linux;
  };
}