diff --git a/pkgs/by-name/he/heimdall/package.nix b/pkgs/by-name/he/heimdall/package.nix new file mode 100644 index 000000000000..b37c357a8382 --- /dev/null +++ b/pkgs/by-name/he/heimdall/package.nix @@ -0,0 +1,67 @@ +{ + cmake, + enableGUI ? false, + fetchFromSourcehut, + gitUpdater, + lib, + libusb1, + pkg-config, + qt6, + stdenv, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "heimdall"; + version = "2.2.1"; + + src = fetchFromSourcehut { + owner = "~grimler"; + repo = "Heimdall"; + rev = "v${finalAttrs.version}"; + hash = "sha256-x+mDTT+oUJ4ffZOmn+UDk3+YE5IevXM8jSxLKhGxXSM="; + }; + + passthru.updateScript = gitUpdater { rev-prefix = "v"; }; + + outputs = [ + "out" + "udev" + ]; + + strictDeps = true; + + nativeBuildInputs = [ + cmake + pkg-config + ] ++ lib.optional enableGUI qt6.wrapQtAppsHook; + + buildInputs = [ + (libusb1.override { withStatic = stdenv.hostPlatform.isWindows; }) + ] ++ lib.optional enableGUI qt6.qtbase; + + preInstall = '' + mkdir -p $udev/lib/udev/rules.d + install -m644 -t $udev/lib/udev/rules.d $src/heimdall/60-heimdall.rules + ''; + + # heimdall cli looked up from PATH by gui + preFixup = lib.optional enableGUI '' + qtWrapperArgs+=(--prefix PATH : "$out/bin") + ''; + + cmakeFlags = [ + (lib.cmakeBool "DISABLE_FRONTEND" (!enableGUI)) + ]; + + meta = { + broken = enableGUI && !stdenv.hostPlatform.isLinux; + description = "Cross-platform open-source tool suite used to flash firmware onto Samsung Galaxy devices"; + homepage = "https://git.sr.ht/~grimler/Heimdall"; + license = lib.licenses.mit; + mainProgram = if enableGUI then "heimdall-frontend" else "heimdall"; + maintainers = with lib.maintainers; [ + surfaceflinger + ]; + platforms = with lib.platforms; unix ++ windows; + }; +}) diff --git a/pkgs/tools/misc/heimdall/default.nix b/pkgs/tools/misc/heimdall/default.nix deleted file mode 100644 index 90af4652dad1..000000000000 --- a/pkgs/tools/misc/heimdall/default.nix +++ /dev/null @@ -1,67 +0,0 @@ -{ - lib, - stdenv, - mkDerivation, - fetchFromGitHub, - cmake, - zlib, - libusb1, - enableGUI ? false, - qtbase ? null, -}: - -mkDerivation rec { - pname = "heimdall${lib.optionalString enableGUI "-gui"}"; - version = "1.4.2"; - - src = fetchFromGitHub { - owner = "Benjamin-Dobell"; - repo = "Heimdall"; - rev = "v${version}"; - sha256 = "1ygn4snvcmi98rgldgxf5hwm7zzi1zcsihfvm6awf9s6mpcjzbqz"; - }; - - buildInputs = [ - zlib - libusb1 - ] ++ lib.optional enableGUI qtbase; - nativeBuildInputs = [ cmake ]; - - cmakeFlags = [ - "-DDISABLE_FRONTEND=${if enableGUI then "OFF" else "ON"}" - "-DLIBUSB_LIBRARY=${libusb1}" - ]; - - preConfigure = - '' - # Give ownership of the Galaxy S USB device to the logged in user. - substituteInPlace heimdall/60-heimdall.rules --replace 'MODE="0666"' 'TAG+="uaccess"' - '' - + lib.optionalString stdenv.hostPlatform.isDarwin '' - substituteInPlace libpit/CMakeLists.txt --replace "-std=gnu++11" "" - ''; - - installPhase = - lib.optionalString (stdenv.hostPlatform.isDarwin && enableGUI) '' - mkdir -p $out/Applications - mv bin/heimdall-frontend.app $out/Applications/heimdall-frontend.app - wrapQtApp $out/Applications/heimdall-frontend.app/Contents/MacOS/heimdall-frontend - '' - + '' - mkdir -p $out/{bin,share/doc/heimdall,lib/udev/rules.d} - install -m755 -t $out/bin bin/* - install -m644 -t $out/lib/udev/rules.d ../heimdall/60-heimdall.rules - install -m644 ../Linux/README $out/share/doc/heimdall/README.linux - install -m644 ../OSX/README.txt $out/share/doc/heimdall/README.osx - ''; - - meta = with lib; { - broken = stdenv.hostPlatform.isDarwin; - homepage = "http://www.glassechidna.com.au/products/heimdall/"; - description = "Cross-platform tool suite to flash firmware onto Samsung Galaxy S devices"; - license = licenses.mit; - maintainers = with maintainers; [ peterhoeg ]; - platforms = platforms.unix; - mainProgram = "heimdall"; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1b312cf1734d..bf24872632db 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -3284,8 +3284,6 @@ with pkgs; heaptrack = libsForQt5.callPackage ../development/tools/profiling/heaptrack { }; - heimdall = libsForQt5.callPackage ../tools/misc/heimdall { }; - heimdall-gui = heimdall.override { enableGUI = true; }; headscale = callPackage ../servers/headscale { };