anchor.diff:      cp -a usr/share/* $out/share
       cp -a opt/balenaEtcher/{locales,resources} $out/share/${pname}
   
  -    substituteInPlace $out/share/applications/balena-etcher-electron.desktop \
  -      --replace 'Exec=/opt/balenaEtcher/balena-etcher-electron' 'Exec=${pname}'
  -
       runHook postInstall
     '';
   
     postFixup = ''
       makeWrapper ${electron}/bin/electron $out/bin/${pname} \
  -      --add-flags $out/share/${pname}/resources/app.asar \
  +      --add-flags $out/share/${pname}/resources/app \
         --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ gcc-unwrapped.lib ]}"
     '';
   
  
positive.code:     "i686-linux" = "i386";
    }."${stdenv.system}";
  
    electron = electron_7;
  
  in
  
  stdenv.mkDerivation rec {
    pname = "etcher";
    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;
    };
  
    dontBuild = true;
    dontConfigure = true;
  
    nativeBuildInputs = [ makeWrapper ];
  
    unpackPhase = ''
      ${dpkg}/bin/dpkg-deb -x $src .
  
negative.code: 
    # 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"'
    '';
  
    installPhase = ''
  