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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
1.7 KiB
Nix
Raw Normal View History

2023-09-24 00:57:28 +00:00
{ lib
, stdenv
, fetchurl
, bash
2023-09-24 00:57:28 +00:00
, util-linux
, autoPatchelfHook
, dpkg
2020-04-27 20:22:56 +00:00
, makeWrapper
2023-09-24 00:57:28 +00:00
, udev
2021-12-01 18:58:22 +00:00
, electron
}:
2020-04-27 20:22:56 +00:00
stdenv.mkDerivation rec {
pname = "etcher";
2023-09-24 00:57:28 +00:00
version = "1.18.12";
src = fetchurl {
2023-09-24 00:57:28 +00:00
url = "https://github.com/balena-io/etcher/releases/download/v${version}/balena-etcher_${version}_amd64.deb";
hash = "sha256-Ucs187xTpbRJ7P32hCl8cHPxO3HCs44ZneAas043FXk=";
};
# sudo-prompt has hardcoded binary paths on Linux and we patch them here
# along with some other paths
2021-04-23 12:21:35 +00:00
postPatch = ''
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"'
'';
2023-09-24 00:57:28 +00:00
nativeBuildInputs = [
autoPatchelfHook
dpkg
makeWrapper
];
buildInputs = [
stdenv.cc.cc.lib
udev
];
dontConfigure = true;
dontBuild = true;
installPhase = ''
2020-04-27 20:22:56 +00:00
runHook preInstall
mkdir -p $out/bin $out/share/${pname}
cp -a usr/share/* $out/share
cp -a opt/balenaEtcher/{locales,resources} $out/share/${pname}
2023-09-24 00:57:28 +00:00
makeWrapper ${electron}/bin/electron $out/bin/${pname} \
--add-flags $out/share/${pname}/resources/app
2021-08-08 06:54:17 +00:00
2023-09-24 00:57:28 +00:00
substituteInPlace $out/share/applications/balena-etcher.desktop \
--replace /opt/balenaEtcher/balena-etcher ${pname}
2023-09-24 00:57:28 +00:00
runHook postInstall
'';
meta = with lib; {
description = "Flash OS images to SD cards and USB drives, safely and easily";
homepage = "https://etcher.io/";
license = licenses.asl20;
2023-09-24 00:57:28 +00:00
mainProgram = pname;
maintainers = with maintainers; [ wegank ];
platforms = [ "x86_64-linux" ];
2022-06-13 17:43:26 +00:00
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
};
}