This repository has been archived on 2025-05-19. You can view files and clone it, but cannot push or open issues or pull requests.
godot-4.4.1/pkgs/godot/default.nix
2025-03-19 13:20:24 +01:00

88 lines
2.2 KiB
Nix

{
stdenv,
lib,
autoPatchelfHook,
makeWrapper,
fetchurl,
unzip,
udev,
alsa-lib,
libXcursor,
libXinerama,
libXrandr,
libXrender,
libX11,
libXi,
libpulseaudio,
libGL,
libxkbcommon,
godotDesktopFile,
godotIconPNG,
godotIconSVG,
godotManpage,
fontconfig,
xorg,
}:
stdenv.mkDerivation rec {
pname = "godot-bin";
version = "4.4.1";
src = fetchurl {
url = "https://github.com/godotengine/godot-builds/releases/download/${version}-rc1/Godot_v4.4.1-rc1_linux.x86_64.zip";
sha256 = "sha256-aIQgp/KBXvV4BBLsLjTXVqSZj0BN5EevEnPFyhaEu3c=";
};
nativeBuildInputs = [autoPatchelfHook makeWrapper unzip];
buildInputs = [
udev
fontconfig
libxkbcommon
alsa-lib
libXcursor
libXinerama
libXrandr
libXrender
libX11
libXi
libpulseaudio
libGL
xorg.libXext
];
libraries = lib.makeLibraryPath buildInputs;
unpackCmd = "unzip $curSrc -d source";
installPhase = ''
mkdir -p $out/bin
install -m 0755 Godot_v${version}-rc1_linux.x86_64 $out/bin/godot
# Only create a desktop file, if the necessary variables are set
# these are set only, if one installs this program using flakes.
if [[ -f "${godotDesktopFile}" ]]; then
mkdir -p "$out/man/share/man/man6"
cp ${godotManpage} "$out/man/share/man/man6/"
mkdir -p $out/share/{applications,icons/hicolor/scalable/apps}
cp ${godotDesktopFile} "$out/share/applications/org.godotengine.Godot.desktop"
cp ${godotIconSVG} "$out/share/icons/hicolor/scalable/apps/godot.svg"
cp ${godotIconPNG} "$out/share/icons/godot.png"
substituteInPlace "$out/share/applications/org.godotengine.Godot.desktop" \
--replace "Exec=godot" "Exec=$out/bin/godot"
fi
'';
postFixup = ''
wrapProgram $out/bin/godot \
--set LD_LIBRARY_PATH ${libraries}
'';
meta = {
homepage = "https://godotengine.org";
description = "Free and Open Source 2D and 3D game engine";
license = lib.licenses.mit;
platforms = ["i686-linux" "x86_64-linux"];
maintainers = [lib.maintainers.twey];
};
}