about summary refs log tree commit diff
path: root/pkgs/development/tools/godot
diff options
context:
space:
mode:
authorJoscha <joscha@plugh.de>2023-02-10 14:23:14 +0100
committerJoscha <joscha@plugh.de>2023-07-19 22:05:30 +0200
commit39ecbaa495b2b7f0591d53de71d1c1cc5c865b52 (patch)
treea7a1f22b5200aafe5e5ac738fc46d1161903ffc5 /pkgs/development/tools/godot
parent6f66c57acc5ef4ca269fa1eb92b8599188b60b8e (diff)
godot_4: clean up scons flag generation
Diffstat (limited to 'pkgs/development/tools/godot')
-rw-r--r--pkgs/development/tools/godot/4/default.nix41
1 files changed, 19 insertions, 22 deletions
diff --git a/pkgs/development/tools/godot/4/default.nix b/pkgs/development/tools/godot/4/default.nix
index 6e1b166ecca03..3269c7796bd0b 100644
--- a/pkgs/development/tools/godot/4/default.nix
+++ b/pkgs/development/tools/godot/4/default.nix
@@ -36,20 +36,10 @@
 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";
@@ -96,14 +86,21 @@ stdenv.mkDerivation rec {
 
   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)
-    }"
-  '';
+  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" ];