diff options
author | Pavol Rusnak <pavol@rusnak.io> | 2020-04-27 22:22:56 +0200 |
---|---|---|
committer | Pavol Rusnak <pavol@rusnak.io> | 2020-05-06 21:48:47 +0200 |
commit | 897a1e639380e0178ed457c2e3f03745ab4522c7 (patch) | |
tree | c886025492f4349a913b61450a626f394d7592f5 /pkgs/tools/misc/etcher | |
parent | b45e6f22f36115624b6b8661de00c6a96724a32f (diff) |
etcher: 1.5.60 -> 1.5.86
Diffstat (limited to 'pkgs/tools/misc/etcher')
-rw-r--r-- | pkgs/tools/misc/etcher/default.nix | 66 |
1 files changed, 28 insertions, 38 deletions
diff --git a/pkgs/tools/misc/etcher/default.nix b/pkgs/tools/misc/etcher/default.nix index 4944600108ae6..0d2029fa31455 100644 --- a/pkgs/tools/misc/etcher/default.nix +++ b/pkgs/tools/misc/etcher/default.nix @@ -1,25 +1,19 @@ -{ lib -, stdenv +{ stdenv , fetchurl , gcc-unwrapped , dpkg , polkit +, utillinux , bash , nodePackages -, electron_3 -, gtk3 -, wrapGAppsHook +, makeWrapper +, electron_7 }: let - libPath = lib.makeLibraryPath [ - # for libstdc++.so.6 - gcc-unwrapped.lib - ]; - sha256 = { - "x86_64-linux" = "0zb9j34dz7ybjix018bm8g0b6kilw9300q4ahcm22p0ggg528dh7"; - "i686-linux" = "0wsv4mvwrvsaz1pwiqs94b3854h5l8ff2dbb1ybxmvwjbfrkdcqc"; + "x86_64-linux" = "1yvqi86bw0kym401zwknhwq9041fxg047sbj3aydnfcqf11vrrmk"; + "i686-linux" = "12lghzhsl16h3jvzm3vw4hrly32fz99z6rdmybl8viralrxy8mb8"; }."${stdenv.system}"; arch = { @@ -27,26 +21,22 @@ let "i686-linux" = "i386"; }."${stdenv.system}"; -in stdenv.mkDerivation rec { +in + +stdenv.mkDerivation rec { pname = "etcher"; - version = "1.5.60"; + version = "1.5.86"; src = fetchurl { url = "https://github.com/balena-io/etcher/releases/download/v${version}/balena-etcher-electron_${version}_${arch}.deb"; inherit sha256; }; - buildInputs = [ - gtk3 - ]; - - nativeBuildInputs = [ - wrapGAppsHook - ]; - dontBuild = true; dontConfigure = true; + nativeBuildInputs = [ makeWrapper ]; + unpackPhase = '' ${dpkg}/bin/dpkg-deb -x $src . ''; @@ -55,33 +45,33 @@ in stdenv.mkDerivation rec { # along with some other paths patchPhase = '' ${nodePackages.asar}/bin/asar extract opt/balenaEtcher/resources/app.asar tmp - # Use Nix(OS) paths + # use Nix(OS) paths sed -i "s|/usr/bin/pkexec|/usr/bin/pkexec', '/run/wrappers/bin/pkexec|" tmp/node_modules/sudo-prompt/index.js sed -i 's|/bin/bash|${bash}/bin/bash|' tmp/node_modules/sudo-prompt/index.js - sed -i "s|process.resourcesPath|'$out/opt/balenaEtcher/resources/'|" tmp/generated/gui.js + sed -i "s|'lsblk'|'${utillinux}/bin/lsblk'|" tmp/node_modules/drivelist/js/lsblk/index.js + sed -i "s|process.resourcesPath|'$out/share/${pname}/resources/'|" tmp/generated/gui.js ${nodePackages.asar}/bin/asar pack tmp opt/balenaEtcher/resources/app.asar rm -rf tmp - # Fix up .desktop file - substituteInPlace usr/share/applications/balena-etcher-electron.desktop \ - --replace "/opt/balenaEtcher/balena-etcher-electron" "$out/bin/balena-etcher-electron" ''; installPhase = '' - mkdir -p $out/bin - cp -r opt $out/ - cp -r usr/share $out/ + runHook preInstall + + mkdir -p $out/bin $out/share/${pname} + + cp -a usr/share/* $out/share + cp -a opt/balenaEtcher/{locales,resources} $out/share/${pname} - # We'll use our Nixpkgs electron_3 instead - rm $out/opt/balenaEtcher/balena-etcher-electron + substituteInPlace $out/share/applications/balena-etcher-electron.desktop \ + --replace 'Exec=/opt/balenaEtcher/balena-etcher-electron' 'Exec=${pname}' - ln -s ${electron_3}/bin/electron $out/bin/balena-etcher-electron + runHook postInstall ''; - preFixup = '' - gappsWrapperArgs+=( - --add-flags $out/opt/balenaEtcher/resources/app.asar - --prefix LD_LIBRARY_PATH : ${libPath} - ) + postFixup = '' + makeWrapper ${electron_7}/bin/electron $out/bin/${pname} \ + --add-flags $out/share/${pname}/resources/app.asar \ + --prefix LD_LIBRARY_PATH : "${stdenv.lib.makeLibraryPath [ gcc-unwrapped.lib ]}" ''; meta = with stdenv.lib; { |