nixpkgs/pkgs/tools/misc/heimdall/default.nix

56 lines
1.9 KiB
Nix
Raw Normal View History

{ lib, stdenv, mkDerivation, fetchFromGitHub, cmake, zlib, libusb1
, enableGUI ? false, qtbase ? null
}:
2016-01-16 00:36:34 +00:00
mkDerivation rec {
pname = "heimdall${lib.optionalString enableGUI "-gui"}";
version = "1.4.2";
2015-01-20 05:37:44 +00:00
src = fetchFromGitHub {
owner = "Benjamin-Dobell";
repo = "Heimdall";
rev = "v${version}";
2017-06-24 04:49:07 +00:00
sha256 = "1ygn4snvcmi98rgldgxf5hwm7zzi1zcsihfvm6awf9s6mpcjzbqz";
};
2017-06-24 04:49:07 +00:00
buildInputs = [
zlib
libusb1
2021-01-15 09:19:50 +00:00
] ++ lib.optional enableGUI qtbase;
2017-06-24 04:49:07 +00:00
nativeBuildInputs = [ cmake ];
2016-05-07 08:46:52 +00:00
cmakeFlags = [
"-DDISABLE_FRONTEND=${if enableGUI then "OFF" else "ON"}"
2020-01-04 09:20:00 +00:00
"-DLIBUSB_LIBRARY=${libusb1}"
2016-05-07 08:46:52 +00:00
];
2013-08-31 14:36:47 +00:00
2016-05-07 08:46:52 +00:00
preConfigure = ''
# Give ownership of the Galaxy S USB device to the logged in user.
substituteInPlace heimdall/60-heimdall.rules --replace 'MODE="0666"' 'TAG+="uaccess"'
2021-01-15 09:19:50 +00:00
'' + lib.optionalString stdenv.isDarwin ''
2020-01-04 09:20:00 +00:00
substituteInPlace libpit/CMakeLists.txt --replace "-std=gnu++11" ""
2016-05-07 08:46:52 +00:00
'';
2021-05-18 19:27:32 +00:00
installPhase = lib.optionalString (stdenv.isDarwin && enableGUI) ''
2021-05-16 09:14:44 +00:00
mkdir -p $out/Applications
mv bin/heimdall-frontend.app $out/Applications/heimdall-frontend.app
wrapQtApp $out/Applications/heimdall-frontend.app/Contents/MacOS/heimdall-frontend
'' + ''
2017-06-24 04:49:07 +00:00
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
2017-06-24 05:18:01 +00:00
install -m644 ../Linux/README $out/share/doc/heimdall/README.linux
install -m644 ../OSX/README.txt $out/share/doc/heimdall/README.osx
2016-05-07 08:46:52 +00:00
'';
meta = with lib; {
broken = stdenv.isDarwin;
homepage = "http://www.glassechidna.com.au/products/heimdall/";
2016-05-07 08:46:52 +00:00
description = "A cross-platform tool suite to flash firmware onto Samsung Galaxy S devices";
license = licenses.mit;
2017-06-24 04:49:07 +00:00
maintainers = with maintainers; [ peterhoeg ];
platforms = platforms.unix;
2023-11-27 01:17:53 +00:00
mainProgram = "heimdall";
};
}