nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 105 lines 2.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 runCommand, 6 buildNpmPackage, 7 clang, 8 go_1_24, 9 libsForQt5, 10 qt6, 11 udevCheckHook, 12}: 13 14let 15 # Qt 6 doesn’t provide the rcc binary so we create an ad hoc package pulling 16 # it from Qt 5. 17 rcc = runCommand "rcc" { } '' 18 mkdir -p $out/bin 19 cp ${lib.getExe' libsForQt5.qt5.qtbase.dev "rcc"} $out/bin 20 ''; 21in 22stdenv.mkDerivation rec { 23 pname = "bitbox"; 24 version = "4.49.0"; 25 26 src = fetchFromGitHub { 27 owner = "BitBoxSwiss"; 28 repo = "bitbox-wallet-app"; 29 tag = "v${version}"; 30 fetchSubmodules = true; 31 hash = "sha256-pl7vtRQCxRwG58bBnT8iAi2qfsdeJrHbzDeHJsYwjnQ="; 32 }; 33 34 postPatch = '' 35 substituteInPlace frontends/qt/resources/linux/usr/share/applications/bitbox.desktop \ 36 --replace-fail 'Exec=BitBox %u' 'Exec=bitbox %u' 37 ''; 38 39 dontConfigure = true; 40 41 passthru.web = buildNpmPackage { 42 pname = "bitbox-web"; 43 inherit version; 44 inherit src; 45 sourceRoot = "${src.name}/frontends/web"; 46 npmDepsHash = "sha256-J3jT286MZGTHgmRXKiXj7lod9wgoEVQrCfOGCtSyG/s="; 47 installPhase = "cp -r build $out"; 48 }; 49 50 buildPhase = '' 51 runHook preBuild 52 53 ln -s ${passthru.web} frontends/web/build 54 export GOCACHE=$TMPDIR/go-cache 55 cd frontends/qt 56 make -C server linux 57 ./genassets.sh 58 qmake -o build/Makefile 59 cd build 60 make 61 cd ../../.. 62 63 runHook postBuild 64 ''; 65 66 installPhase = '' 67 runHook preInstall 68 69 mkdir $out 70 cp -r frontends/qt/resources/linux/usr/share $out 71 mkdir $out/{bin,lib} 72 cp frontends/qt/build/BitBox $out/bin/bitbox 73 cp frontends/qt/build/assets.rcc $out/bin 74 cp frontends/qt/server/libserver.so $out/lib 75 install -m 644 -Dt $out/lib/udev/rules.d ${./rules.d}/* 76 77 runHook postInstall 78 ''; 79 80 buildInputs = [ qt6.qtwebengine ]; 81 82 nativeBuildInputs = [ 83 clang 84 go_1_24 85 qt6.wrapQtAppsHook 86 rcc 87 udevCheckHook 88 ]; 89 90 doInstallCheck = true; 91 92 meta = { 93 description = "Companion app for the BitBox02 hardware wallet"; 94 homepage = "https://bitbox.swiss/app/"; 95 downloadPage = "https://github.com/BitBoxSwiss/bitbox-wallet-app"; 96 changelog = "https://github.com/BitBoxSwiss/bitbox-wallet-app/blob/master/CHANGELOG.md#${ 97 builtins.replaceStrings [ "." ] [ "" ] version 98 }"; 99 license = lib.licenses.asl20; 100 maintainers = [ lib.maintainers.tensor5 ]; 101 mainProgram = "bitbox"; 102 sourceProvenance = [ lib.sourceTypes.fromSource ]; 103 platforms = [ "x86_64-linux" ]; 104 }; 105}