heimdall{,-gui}: modernize and update

- bumped to 2.2.1, different upstream
- unmarked darwin as broken (at least without gui)
- added udev output
- dropped icons etc. for darwin
- made it build in windows
- added updateScript
- gui got ported to qt6 so switched it to qt6
- dropped peterhoeg from maintainers and added myself
- moved to by-name
- switched to finalAttrs pattern
- enabled strictDeps
- fixed heimdall-gui when ran with eg. `nix run`
This commit is contained in:
nat
2025-06-10 08:24:13 +00:00
committed by Peter Hoeg
parent 33aa613cfa
commit 5e68db132d
3 changed files with 67 additions and 69 deletions
+67
View File
@@ -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;
};
})
-67
View File
@@ -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";
};
}
-2
View File
@@ -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 { };