1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
|
{ stdenv
, lib
, fetchFromGitHub
, installShellFiles
, autoPatchelfHook
, pkg-config
, scons
, vulkan-loader
, libX11
, libXcursor
, libXinerama
, libXext
, libXrandr
, libXrender
, libXi
, libXfixes
, freetype
, alsa-lib
, libpulseaudio
, dbus
, speechd
, fontconfig
, udev
, withPlatform ? "linuxbsd"
, withTarget ? "editor"
, withPrecision ? "single"
, withPulseaudio ? false
, withDbus ? true
, withSpeechd ? false
, withFontconfig ? true
, withUdev ? true
, withTouch ? true
}:
assert lib.asserts.assertOneOf "withPrecision" withPrecision [ "single" "double" ];
let
options = {
# Options from 'godot/SConstruct'
platform = withPlatform;
target = withTarget;
precision = withPrecision; # Floating-point precision level
# Options from 'godot/platform/linuxbsd/detect.py'
pulseaudio = withPulseaudio;
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";
version = "4.0-beta14";
src = fetchFromGitHub {
owner = "godotengine";
repo = "godot";
rev = "28a24639c3c6a95b5b9828f5f02bf0dc2f5ce54b";
sha256 = "sha256-qAotCc2YUg8FMK+JFHi5B4OL/cAtvWO/pYRRz8RcNUY=";
};
nativeBuildInputs = [
pkg-config
autoPatchelfHook
installShellFiles
];
buildInputs = [
scons
]
++ runtimeDependencies;
runtimeDependencies = [
libX11
libXcursor
libXinerama
libXext
libXrandr
libXrender
libXi
libXfixes
alsa-lib
vulkan-loader
]
++ lib.optional withPulseaudio libpulseaudio
++ lib.optional withDbus dbus
++ lib.optional withDbus dbus.lib
++ lib.optional withSpeechd speechd
++ lib.optional withFontconfig fontconfig
++ lib.optional withFontconfig fontconfig.lib
++ lib.optional withUdev udev;
patches = [
# Godot expects to find xfixes inside xi, but nix's pkg-config only
# gives the libs for the requested package (ignoring the propagated-build-inputs)
./xfixes.patch
];
enableParallelBuilding = true;
# Options from 'godot/SConstruct' and 'godot/platform/linuxbsd/detect.py'
sconsFlags = [ "production=true" ];
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" ];
maintainers = with maintainers; [ twey shiryel ];
};
}
|