about summary refs log tree commit diff
path: root/pkgs/development/tools/godot
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/godot')
-rw-r--r--pkgs/development/tools/godot/4/default.nix67
1 files changed, 44 insertions, 23 deletions
diff --git a/pkgs/development/tools/godot/4/default.nix b/pkgs/development/tools/godot/4/default.nix
index 8e77a7e9e298f..986d2d7745f39 100644
--- a/pkgs/development/tools/godot/4/default.nix
+++ b/pkgs/development/tools/godot/4/default.nix
@@ -36,30 +36,21 @@
 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; # Use PulseAudio
-    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
-  };
+  mkSconsFlagsFromAttrSet = lib.mapAttrsToList (k: v:
+    if builtins.isString v
+    then "${k}=${v}"
+    else "${k}=${builtins.toJSON v}");
 in
 stdenv.mkDerivation rec {
   pname = "godot";
-  version = "4.0.3-stable";
+  version = "4.1.1";
+  commitHash = "bd6af8e0ea69167dd0627f3bd54f9105bda0f8b5";
 
   src = fetchFromGitHub {
     owner = "godotengine";
     repo = "godot";
-    rev = version;
-    hash = "sha256-g9+CV3HsiJqiSJpZvK0N7BqKzp2Pvi6otjRLsFdmWGk=";
+    rev = commitHash;
+    hash = "sha256-0CErsMTrBC/zYcabAtjYn8BWAZ1HxgozKdgiqdsn3q8=";
   };
 
   nativeBuildInputs = [
@@ -96,15 +87,44 @@ stdenv.mkDerivation rec {
 
   enableParallelBuilding = true;
 
-  # Options from 'godot/SConstruct' and 'godot/platform/linuxbsd/detect.py'
-  sconsFlags = [ "production=true" ];
+  # Set the build name which is part of the version. In official downloads, this
+  # is set to 'official'. When not specified explicitly, it is set to
+  # 'custom_build'. Other platforms packaging Godot (Gentoo, Arch, Flatpack
+  # etc.) usually set this to their name as well.
+  #
+  # See also 'methods.py' in the Godot repo and 'build' in
+  # https://docs.godotengine.org/en/stable/classes/class_engine.html#class-engine-method-get-version-info
+  BUILD_NAME = "nixpkgs";
+
+  # Required for the commit hash to be included in the version number.
+  #
+  # `methods.py` reads the commit hash from `.git/HEAD` and manually follows
+  # refs. Since we just write the hash directly, there is no need to emulate any
+  # other parts of the .git directory.
+  #
+  # See also 'hash' in
+  # https://docs.godotengine.org/en/stable/classes/class_engine.html#class-engine-method-get-version-info
   preConfigure = ''
-    sconsFlags+=" ${
-      lib.concatStringsSep " "
-      (lib.mapAttrsToList (k: v: "${k}=${builtins.toJSON v}") options)
-    }"
+    mkdir -p .git
+    echo ${commitHash} > .git/HEAD
   '';
 
+  sconsFlags = mkSconsFlagsFromAttrSet {
+    # Options from 'SConstruct'
+    production = true; # Set defaults to build Godot for use in production
+    platform = withPlatform;
+    target = withTarget;
+    precision = withPrecision; # Floating-point precision level
+
+    # Options from 'platform/linuxbsd/detect.py'
+    pulseaudio = withPulseaudio; # Use PulseAudio
+    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
+  };
+
   outputs = [ "out" "man" ];
 
   installPhase = ''
@@ -128,5 +148,6 @@ stdenv.mkDerivation rec {
     license = licenses.mit;
     platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];
     maintainers = with maintainers; [ twey shiryel ];
+    mainProgram = "godot4";
   };
 }