Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 wrapGAppsHook3,
6 python3Packages,
7 makeDesktopItem,
8 copyDesktopItems,
9 nix-update-script,
10}:
11python3Packages.buildPythonApplication rec {
12 pname = "pixelflasher";
13 version = "8.3.1.0";
14 format = "other";
15
16 src = fetchFromGitHub {
17 owner = "badabing2005";
18 repo = "PixelFlasher";
19 tag = "v${version}";
20 hash = "sha256-/IEnQQ1fUKWeoKIOH4q9NmWM2Sz/b1xDqQ1s9zEWOI8=";
21 };
22
23 desktopItems = [
24 (makeDesktopItem {
25 name = "PixelFlasher";
26 exec = "pixelflasher";
27 icon = "pixelflasher";
28 desktopName = "PixelFlasher";
29 genericName = "Pixel™ phone flashing GUI utility with features";
30 categories = [ "Development" ];
31 })
32 ];
33
34 dependencies = with python3Packages; [
35 attrdict
36 beautifulsoup4
37 bsdiff4
38 chardet
39 cryptography
40 darkdetect
41 httplib2
42 json5
43 lz4
44 markdown
45 platformdirs
46 polib
47 protobuf
48 psutil
49 pyperclip
50 requests
51 rsa
52 six
53 wxpython
54 ];
55
56 nativeBuildInputs = [
57 wrapGAppsHook3
58 python3Packages.pyinstaller
59 copyDesktopItems
60 ];
61
62 buildPhase =
63 let
64 specFile =
65 if stdenv.hostPlatform.isDarwin then
66 if stdenv.hostPlatform.isAarch64 then "build-on-mac" else "build-on-mac-intel-only"
67 else
68 "build-on-linux";
69 in
70 ''
71 runHook preBuild
72
73 pyinstaller --clean --noconfirm --log-level=DEBUG ${specFile}.spec
74
75 runHook postBuild
76 '';
77
78 installPhase = ''
79 runHook preInstall
80
81 mkdir -p $out/bin
82 mkdir -p $out/share/icons/hicolor/64x64/apps
83 cp dist/PixelFlasher $out/bin/pixelflasher
84 cp images/icon-64.png $out/share/icons/hicolor/64x64/apps/pixelflasher.png
85
86 runHook postInstall
87 '';
88
89 passthru.updateScript = nix-update-script { };
90
91 meta = {
92 description = "Pixel™ phone flashing GUI utility with features";
93 homepage = "https://github.com/badabing2005/PixelFlasher";
94 changelog = "https://github.com/badabing2005/PixelFlasher/releases/tag/v${version}";
95 license = lib.licenses.agpl3Plus;
96 maintainers = with lib.maintainers; [ cything ];
97 mainProgram = "pixelflasher";
98 platforms = lib.platforms.linux;
99 };
100}