nixos-config/user/pkgs/blockbench.nix

57 lines
2.1 KiB
Nix
Raw Normal View History

2023-08-05 00:17:41 +05:30
{ config, stdenv, fetchurl, appimageTools, makeWrapper, electron_22, lib, pkgs, ... }:
{
nixpkgs.overlays = [
(self: super:
{
blockbench-electron =
super.blockbench-electron.overrideAttrs (oldAttrs: rec {
pname = "blockbench-electron";
alias = "blockbench";
2023-08-05 00:17:41 +05:30
version = "4.8.1";
src = super.fetchurl {
2023-08-05 00:17:41 +05:30
inherit pname version;
url = "https://github.com/JannisX11/blockbench/releases/download/v${version}/Blockbench_${version}.AppImage";
sha256 = "sha256-CE2wDOt1WBcYmPs4sEyZ3LYvKLequFZH0B3huMYHlwA=";
name = "${pname}-${version}.AppImage";
};
appimageContents = super.appimageTools.extractType2 {
2023-08-05 00:17:41 +05:30
inherit pname version;
name = "${pname}-${version}";
inherit src;
};
dontUnpack = true;
dontConfigure = true;
dontBuild = true;
nativeBuildInputs = [ super.makeWrapper ];
2023-08-05 00:17:41 +05:30
installPhase = ''
runHook preInstall
mkdir -p $out/bin $out/share/${pname} $out/share/applications
cp -a ${appimageContents}/{locales,resources} $out/share/${pname}
cp -a ${appimageContents}/blockbench.desktop $out/share/applications/${pname}.desktop
cp -a ${appimageContents}/usr/share/icons $out/share
substituteInPlace $out/share/applications/${pname}.desktop \
--replace 'Exec=AppRun' 'Exec=${pname}'
runHook postInstall
'';
postFixup = ''
makeWrapper ${super.electron_22}/bin/electron $out/bin/${pname} \
--add-flags $out/share/${pname}/resources/app.asar \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ super.stdenv.cc.cc ]}"
makeWrapper ${super.electron_22}/bin/electron $out/bin/${alias} \
2023-08-05 00:17:41 +05:30
--add-flags $out/share/${pname}/resources/app.asar \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ super.stdenv.cc.cc ]}"
2023-08-05 00:17:41 +05:30
'';
});
}
)
];
}