diff options
author | Alexander Bantyev <balsoft@balsoft.ru> | 2022-02-11 08:37:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-11 08:37:10 +0300 |
commit | 8ea208739449a10d5deee5cea0f229ac3a65cfb6 (patch) | |
tree | 7c585e03596f7a2e51d71e9b9902024c074fa1f2 | |
parent | e70ac149d1574bfdf66a0c27c809b94919f27e11 (diff) | |
parent | 23312fa24b561dc76490857fe05e81706b86ff62 (diff) |
Merge pull request #159057 from cab404/qFlipper
qFlipper: re-init at 0.8.2
-rw-r--r-- | pkgs/tools/misc/qflipper/default.nix | 121 | ||||
-rw-r--r-- | pkgs/top-level/aliases.nix | 1 | ||||
-rw-r--r-- | pkgs/top-level/all-packages.nix | 2 |
3 files changed, 105 insertions, 19 deletions
diff --git a/pkgs/tools/misc/qflipper/default.nix b/pkgs/tools/misc/qflipper/default.nix index 78bb6c839e6e7..d0125377763d9 100644 --- a/pkgs/tools/misc/qflipper/default.nix +++ b/pkgs/tools/misc/qflipper/default.nix @@ -1,31 +1,116 @@ -{ lib, fetchurl, appimageTools }: +{ stdenv +, lib +, fetchFromGitHub +, pkg-config +, zlib +, libusb1 +, libGL +, qmake +, wrapQtAppsHook +, mkDerivation +, qttools +, qtbase +, qt3d +, qtsvg +, qtserialport +, qtdeclarative +, qtquickcontrols +, qtquickcontrols2 +, qtgraphicaleffects +, qtwayland +}: let - pname = "qflipper"; - version = "0.5.3"; - name = "${pname}-${version}"; - src = fetchurl { - url = "https://update.flipperzero.one/builds/qFlipper/${version}/qFlipper-x86_64-${version}.AppImage"; - sha256 = "sha256-UFGFl1zb0t1y7FBd5EX1YS3npWM5slL/wLiTOF/CLNM="; + version = "0.8.2"; + timestamp = "99999999999"; + commit = "nix-${version}"; + hash = "sha256-BaqKlF2SZueykFhtj91McP39oXYAx+lz8eXhn5eouqg="; + + udev_rules = '' + #Flipper Zero serial port + SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="5740", ATTRS{manufacturer}=="Flipper Devices Inc.", TAG+="uaccess" + #Flipper Zero DFU + SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", ATTRS{manufacturer}=="STMicroelectronics", TAG+="uaccess" + ''; + +in +mkDerivation { + pname = "qFlipper"; + inherit version; + + src = fetchFromGitHub { + owner = "flipperdevices"; + repo = "qFlipper"; + rev = version; + inherit hash; + fetchSubmodules = true; }; - appimageContents = appimageTools.extractType2 { inherit name src; }; -in appimageTools.wrapType2 { - inherit name src; + nativeBuildInputs = [ + pkg-config + qmake + qttools + ]; + + buildInputs = [ + zlib + libusb1 + libGL + wrapQtAppsHook + + qtbase + qt3d + qtsvg + qtserialport + qtdeclarative + qtquickcontrols + qtquickcontrols2 + qtgraphicaleffects + ] ++ lib.optionals (stdenv.isLinux) [ + qtwayland + ]; + + preBuild = '' + substituteInPlace qflipper_common.pri \ + --replace 'GIT_VERSION = unknown' 'GIT_VERSION = "${version}"' \ + --replace 'GIT_TIMESTAMP = 0' 'GIT_TIMESTAMP = ${timestamp}' \ + --replace 'GIT_COMMIT = unknown' 'GIT_COMMIT = "${commit}"' + cat qflipper_common.pri - extraPkgs = pkgs: (appimageTools.defaultFhsEnvArgs.multiPkgs pkgs) ++ [ pkgs.libsecret ]; + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin + ${lib.optionalString stdenv.isLinux '' + install -Dm755 qFlipper $out/bin/qFlipper + ''} + ${lib.optionalString stdenv.isDarwin '' + install -Dm755 qFlipper.app/Contents/MacOS/qFlipper $out/bin/qFlipper + ''} + cp qFlipperTool $out/bin + + mkdir -p $out/share/applications + cp installer-assets/appimage/qFlipper.desktop $out/share/applications - extraInstallCommands = '' - mv $out/bin/${name} $out/bin/qFlipper - install -m 444 -D ${appimageContents}/qFlipper.desktop -t $out/share/applications - cp -r ${appimageContents}/usr/share/icons $out/share + mkdir -p $out/share/icons + cp application/assets/icons/qFlipper.png $out/share/icons + + mkdir -p $out/etc/udev/rules.d + tee $out/etc/udev/rules.d/42-flipperzero.rules << EOF + ${udev_rules} + EOF + + runHook postInstall ''; meta = with lib; { description = "Cross-platform desktop tool to manage your flipper device"; homepage = "https://flipperzero.one/"; - license = licenses.unfree; - maintainers = with maintainers; [ wolfangaukang ]; - platforms = [ "x86_64-linux" ]; + license = licenses.gpl3Only; + maintainers = with maintainers; [ cab404 ]; + platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ]; # qtbase doesn't build yet on aarch64-darwin }; + } diff --git a/pkgs/top-level/aliases.nix b/pkgs/top-level/aliases.nix index 91d27030f6382..b101a32d2142d 100644 --- a/pkgs/top-level/aliases.nix +++ b/pkgs/top-level/aliases.nix @@ -982,6 +982,7 @@ mapAliases ({ QmidiNet = qmidinet; # Added 2016-05-22 qca-qt5 = libsForQt5.qca-qt5; # Added 2015-12-19 qcsxcad = libsForQt5.qcsxcad; # Added 2020-11-05 + qflipper = qFlipper; # Added 2022-02-11 qmk_firmware = throw "qmk_firmware has been removed because it was broken"; # Added 2021-04-02 qr-filetransfer = throw ''"qr-filetransfer" has been renamed to "qrcp"''; # Added 2020-12-02 qt-3 = throw "qt-3 has been removed from nixpkgs, as it's unmaintained and insecure"; # Added 2021-02-15 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d2d7095959086..535c7e258bda9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1050,7 +1050,7 @@ with pkgs; pferd = callPackage ../tools/misc/pferd {}; - qflipper = callPackage ../tools/misc/qflipper { }; + qFlipper = libsForQt515.callPackage ../tools/misc/qflipper { }; quich = callPackage ../tools/misc/quich { } ; |