nixpkgs/pkgs/development/tools/godot/4/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

132 lines
3.1 KiB
Nix
Raw Normal View History

2022-10-20 04:34:44 +00:00
{ stdenv
, lib
, fetchFromGitHub
, pkg-config
2023-01-28 05:41:33 +00:00
, autoPatchelfHook
, installShellFiles
2022-10-20 04:34:44 +00:00
, scons
, vulkan-loader
2023-01-28 05:41:33 +00:00
, libGL
2022-10-20 04:34:44 +00:00
, libX11
, libXcursor
, libXinerama
, libXext
2022-12-28 21:37:48 +00:00
, libXrandr
, libXrender
, libXi
2022-10-20 04:34:44 +00:00
, libXfixes
2023-01-28 05:41:33 +00:00
, libxkbcommon
2022-10-20 04:34:44 +00:00
, alsa-lib
, libpulseaudio
, dbus
, speechd
, fontconfig
, udev
2022-12-28 21:37:48 +00:00
, withPlatform ? "linuxbsd"
, withTarget ? "editor"
, withPrecision ? "single"
2023-01-28 05:41:33 +00:00
, withPulseaudio ? true
2022-10-20 04:34:44 +00:00
, withDbus ? true
2023-01-28 05:41:33 +00:00
, withSpeechd ? true
2022-10-20 04:34:44 +00:00
, withFontconfig ? true
, withUdev ? true
, withTouch ? true
}:
2022-12-28 21:37:48 +00:00
assert lib.asserts.assertOneOf "withPrecision" withPrecision [ "single" "double" ];
2022-10-20 04:34:44 +00:00
let
options = {
2022-12-28 21:37:48 +00:00
# Options from 'godot/SConstruct'
platform = withPlatform;
target = withTarget;
precision = withPrecision; # Floating-point precision level
# Options from 'godot/platform/linuxbsd/detect.py'
2023-01-28 05:41:33 +00:00
pulseaudio = withPulseaudio; # Use PulseAudio
2022-10-20 04:34:44 +00:00
dbus = withDbus; # Use D-Bus to handle screensaver and portal desktop settings
speechd = withSpeechd; # Use Speech Dispatcher for Text-to-Speech support
fontconfig = withFontconfig; # Use fontconfig for system fonts support
udev = withUdev; # Use udev for gamepad connection callbacks
touch = withTouch; # Enable touch events
};
in
stdenv.mkDerivation rec {
pname = "godot";
2023-04-18 17:36:39 +00:00
version = "4.0.2-stable";
2022-10-20 04:34:44 +00:00
src = fetchFromGitHub {
owner = "godotengine";
repo = "godot";
2023-03-01 18:05:11 +00:00
rev = version;
2023-04-18 17:36:39 +00:00
hash = "sha256-kFIpY8kHa8ds/JgYWcUMB4RhwcJDebfeWFnI3BkFWiI=";
2022-10-20 04:34:44 +00:00
};
nativeBuildInputs = [
pkg-config
autoPatchelfHook
installShellFiles
];
buildInputs = [
scons
2023-01-28 05:41:33 +00:00
];
2022-12-28 21:37:48 +00:00
runtimeDependencies = [
2023-01-28 05:41:33 +00:00
vulkan-loader
libGL
2022-10-20 04:34:44 +00:00
libX11
libXcursor
libXinerama
libXext
2022-12-28 21:37:48 +00:00
libXrandr
libXrender
libXi
2022-10-20 04:34:44 +00:00
libXfixes
2023-01-28 05:41:33 +00:00
libxkbcommon
2022-10-20 04:34:44 +00:00
alsa-lib
]
++ lib.optional withPulseaudio libpulseaudio
2022-12-28 21:37:48 +00:00
++ lib.optional withDbus dbus
2022-10-20 04:34:44 +00:00
++ lib.optional withDbus dbus.lib
++ lib.optional withSpeechd speechd
2022-12-28 21:37:48 +00:00
++ lib.optional withFontconfig fontconfig
2022-10-20 04:34:44 +00:00
++ lib.optional withFontconfig fontconfig.lib
++ lib.optional withUdev udev;
enableParallelBuilding = true;
2022-12-28 21:37:48 +00:00
# Options from 'godot/SConstruct' and 'godot/platform/linuxbsd/detect.py'
sconsFlags = [ "production=true" ];
2022-10-20 04:34:44 +00:00
preConfigure = ''
sconsFlags+=" ${
lib.concatStringsSep " "
(lib.mapAttrsToList (k: v: "${k}=${builtins.toJSON v}") options)
}"
'';
outputs = [ "out" "man" ];
installPhase = ''
mkdir -p "$out/bin"
cp bin/godot.* $out/bin/godot
installManPage misc/dist/linux/godot.6
mkdir -p "$out"/share/{applications,icons/hicolor/scalable/apps}
cp misc/dist/linux/org.godotengine.Godot.desktop "$out/share/applications/"
substituteInPlace "$out/share/applications/org.godotengine.Godot.desktop" \
--replace "Exec=godot" "Exec=$out/bin/godot"
cp icon.svg "$out/share/icons/hicolor/scalable/apps/godot.svg"
cp icon.png "$out/share/icons/godot.png"
'';
meta = with lib; {
homepage = "https://godotengine.org";
description = "Free and Open Source 2D and 3D game engine";
license = licenses.mit;
platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];
2022-10-20 04:34:44 +00:00
maintainers = with maintainers; [ twey shiryel ];
};
}