Better implementation for blockbench override

This commit is contained in:
Emmet 2023-08-08 21:47:35 -05:00
parent f9f6716a38
commit 6e969b64da

View file

@ -5,20 +5,19 @@
(self: super: (self: super:
{ {
blockbench-electron = blockbench-electron =
let
inherit (pkgs) fetchurl stdenv appimageTools makeWrapper electron_22;
in
super.blockbench-electron.overrideAttrs (oldAttrs: rec { super.blockbench-electron.overrideAttrs (oldAttrs: rec {
pname = "blockbench-electron"; pname = "blockbench-electron";
alias = "blockbench";
version = "4.8.1"; version = "4.8.1";
src = fetchurl {
src = super.fetchurl {
inherit pname version; inherit pname version;
url = "https://github.com/JannisX11/blockbench/releases/download/v${version}/Blockbench_${version}.AppImage"; url = "https://github.com/JannisX11/blockbench/releases/download/v${version}/Blockbench_${version}.AppImage";
sha256 = "sha256-CE2wDOt1WBcYmPs4sEyZ3LYvKLequFZH0B3huMYHlwA="; sha256 = "sha256-CE2wDOt1WBcYmPs4sEyZ3LYvKLequFZH0B3huMYHlwA=";
name = "${pname}-${version}.AppImage"; name = "${pname}-${version}.AppImage";
}; };
appimageContents = appimageTools.extractType2 { appimageContents = super.appimageTools.extractType2 {
inherit pname version; inherit pname version;
name = "${pname}-${version}"; name = "${pname}-${version}";
inherit src; inherit src;
@ -28,7 +27,7 @@
dontConfigure = true; dontConfigure = true;
dontBuild = true; dontBuild = true;
nativeBuildInputs = [ makeWrapper ]; nativeBuildInputs = [ super.makeWrapper ];
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
@ -42,9 +41,13 @@
''; '';
postFixup = '' postFixup = ''
makeWrapper ${electron_22}/bin/electron $out/bin/${pname} \ makeWrapper ${super.electron_22}/bin/electron $out/bin/${pname} \
--add-flags $out/share/${pname}/resources/app.asar \ --add-flags $out/share/${pname}/resources/app.asar \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ stdenv.cc.cc ]}" --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ super.stdenv.cc.cc ]}"
makeWrapper ${super.electron_22}/bin/electron $out/bin/${alias} \
--add-flags $out/share/${pname}/resources/app.asar \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ super.stdenv.cc.cc ]}"
''; '';
}); });
} }