2022-02-11 01:54:20 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, zlib
|
|
|
|
, libusb1
|
|
|
|
, libGL
|
|
|
|
, qmake
|
|
|
|
, wrapQtAppsHook
|
|
|
|
, mkDerivation
|
2021-11-17 03:05:44 +01:00
|
|
|
|
2022-02-11 01:54:20 +01:00
|
|
|
, qttools
|
|
|
|
, qtbase
|
|
|
|
, qt3d
|
|
|
|
, qtsvg
|
|
|
|
, qtserialport
|
|
|
|
, qtdeclarative
|
|
|
|
, qtquickcontrols
|
|
|
|
, qtquickcontrols2
|
|
|
|
, qtgraphicaleffects
|
|
|
|
, qtwayland
|
2022-04-30 00:55:33 +02:00
|
|
|
, nix-update-script
|
2022-02-11 01:54:20 +01:00
|
|
|
}:
|
2021-11-17 03:05:44 +01:00
|
|
|
let
|
2022-04-30 00:55:33 +02:00
|
|
|
pname = "qFlipper";
|
|
|
|
version = "1.0.2";
|
|
|
|
sha256 = "sha256-CJQOEUwYPNd4x+uBINrxeYVITtYrsEFaYLHQh2l12kA=";
|
2022-02-11 01:54:20 +01:00
|
|
|
timestamp = "99999999999";
|
|
|
|
commit = "nix-${version}";
|
|
|
|
|
|
|
|
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 {
|
2022-04-30 00:55:33 +02:00
|
|
|
inherit pname version;
|
2022-02-11 01:54:20 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "flipperdevices";
|
|
|
|
repo = "qFlipper";
|
|
|
|
rev = version;
|
|
|
|
fetchSubmodules = true;
|
2022-04-30 00:55:33 +02:00
|
|
|
inherit sha256;
|
2021-11-17 03:05:44 +01:00
|
|
|
};
|
|
|
|
|
2022-02-11 01:54:20 +01:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pkg-config
|
|
|
|
qmake
|
|
|
|
qttools
|
2022-04-06 23:46:18 +02:00
|
|
|
wrapQtAppsHook
|
2022-02-11 01:54:20 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
zlib
|
|
|
|
libusb1
|
|
|
|
libGL
|
|
|
|
|
|
|
|
qtbase
|
|
|
|
qt3d
|
|
|
|
qtsvg
|
|
|
|
qtserialport
|
|
|
|
qtdeclarative
|
|
|
|
qtquickcontrols
|
|
|
|
qtquickcontrols2
|
|
|
|
qtgraphicaleffects
|
|
|
|
] ++ lib.optionals (stdenv.isLinux) [
|
|
|
|
qtwayland
|
|
|
|
];
|
|
|
|
|
2022-04-06 23:46:18 +02:00
|
|
|
qmakeFlags = [
|
|
|
|
"DEFINES+=DISABLE_APPLICATION_UPDATES"
|
|
|
|
"CONFIG+=qtquickcompiler"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2022-02-11 01:54:20 +01:00
|
|
|
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
|
|
|
|
'';
|
|
|
|
|
2022-04-06 23:46:18 +02:00
|
|
|
postInstall = ''
|
2022-02-11 01:54:20 +01:00
|
|
|
mkdir -p $out/bin
|
|
|
|
${lib.optionalString stdenv.isDarwin ''
|
2022-04-06 23:46:18 +02:00
|
|
|
cp qFlipper.app/Contents/MacOS/qFlipper $out/bin
|
2022-02-11 01:54:20 +01:00
|
|
|
''}
|
2022-04-06 23:46:18 +02:00
|
|
|
cp qFlipper-cli $out/bin
|
2022-02-11 01:54:20 +01:00
|
|
|
|
|
|
|
mkdir -p $out/etc/udev/rules.d
|
|
|
|
tee $out/etc/udev/rules.d/42-flipperzero.rules << EOF
|
|
|
|
${udev_rules}
|
|
|
|
EOF
|
2021-11-17 03:05:44 +01:00
|
|
|
'';
|
|
|
|
|
2022-04-30 00:55:33 +02:00
|
|
|
passthru.updateScript = nix-update-script {
|
|
|
|
attrPath = pname;
|
|
|
|
};
|
|
|
|
|
2021-11-17 03:05:44 +01:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Cross-platform desktop tool to manage your flipper device";
|
|
|
|
homepage = "https://flipperzero.one/";
|
2022-02-11 01:54:20 +01:00
|
|
|
license = licenses.gpl3Only;
|
|
|
|
maintainers = with maintainers; [ cab404 ];
|
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" ]; # qtbase doesn't build yet on aarch64-darwin
|
2021-11-17 03:05:44 +01:00
|
|
|
};
|
2022-02-11 01:54:20 +01:00
|
|
|
|
2021-11-17 03:05:44 +01:00
|
|
|
}
|