Merge pull request #256993 from wegank/etcher-bump

etcher: 1.7.9 -> 1.18.12
This commit is contained in:
Weijia Wang 2023-09-24 14:01:18 +02:00 committed by GitHub
commit 54ea412f48
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 45 deletions

View File

@ -1,58 +1,48 @@
{ lib, stdenv
{ lib
, stdenv
, fetchurl
, gcc-unwrapped
, dpkg
, util-linux
, bash
, util-linux
, autoPatchelfHook
, dpkg
, makeWrapper
, udev
, electron
}:
let
inherit (stdenv.hostPlatform) system;
throwSystem = throw "Unsupported system: ${stdenv.hostPlatform.system}";
sha256 = {
"x86_64-linux" = "1rcidar97nnpjb163x9snnnhw1z1ld4asgbd5dxpzdh8hikh66ll";
"i686-linux" = "1jll4i0j9kh78kl10s596xxs60gy7cnlafgpk89861yihj0i73a5";
}."${system}" or throwSystem;
arch = {
"x86_64-linux" = "amd64";
"i686-linux" = "i386";
}."${system}" or throwSystem;
in
stdenv.mkDerivation rec {
pname = "etcher";
version = "1.7.9";
version = "1.18.12";
src = fetchurl {
url = "https://github.com/balena-io/etcher/releases/download/v${version}/balena-etcher-electron_${version}_${arch}.deb";
inherit sha256;
url = "https://github.com/balena-io/etcher/releases/download/v${version}/balena-etcher_${version}_amd64.deb";
hash = "sha256-Ucs187xTpbRJ7P32hCl8cHPxO3HCs44ZneAas043FXk=";
};
nativeBuildInputs = [ makeWrapper ];
dontConfigure = true;
dontBuild = true;
unpackPhase = ''
${dpkg}/bin/dpkg-deb -x $src .
'';
# sudo-prompt has hardcoded binary paths on Linux and we patch them here
# along with some other paths
postPatch = ''
# use Nix(OS) paths
substituteInPlace opt/balenaEtcher/resources/app/generated/gui.js \
--replace '/usr/bin/pkexec' '/usr/bin/pkexec", "/run/wrappers/bin/pkexec' \
--replace '/bin/bash' '${bash}/bin/bash' \
--replace '"lsblk"' '"${util-linux}/bin/lsblk"'
'';
nativeBuildInputs = [
autoPatchelfHook
dpkg
makeWrapper
];
buildInputs = [
stdenv.cc.cc.lib
udev
];
dontConfigure = true;
dontBuild = true;
installPhase = ''
runHook preInstall
@ -61,24 +51,22 @@ stdenv.mkDerivation rec {
cp -a usr/share/* $out/share
cp -a opt/balenaEtcher/{locales,resources} $out/share/${pname}
substituteInPlace $out/share/applications/balena-etcher-electron.desktop \
--replace /opt/balenaEtcher/balena-etcher-electron ${pname}
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--add-flags $out/share/${pname}/resources/app
substituteInPlace $out/share/applications/balena-etcher.desktop \
--replace /opt/balenaEtcher/balena-etcher ${pname}
runHook postInstall
'';
postFixup = ''
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--add-flags $out/share/${pname}/resources/app \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ gcc-unwrapped.lib ]}"
'';
meta = with lib; {
description = "Flash OS images to SD cards and USB drives, safely and easily";
homepage = "https://etcher.io/";
license = licenses.asl20;
maintainers = [ maintainers.shou ];
platforms = [ "i686-linux" "x86_64-linux" ];
mainProgram = pname;
maintainers = with maintainers; [ wegank ];
platforms = [ "x86_64-linux" ];
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
}

View File

@ -7978,7 +7978,7 @@ with pkgs;
esshader = callPackage ../tools/graphics/esshader { };
etcher = callPackage ../tools/misc/etcher {
electron = electron_12;
electron = electron_19;
};
ethercalc = callPackage ../servers/web-apps/ethercalc { };