mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-07 14:23:19 +00:00
e138e656c7
The godot base derivation was implemented by passing a recursive attrset to mkDerivation. This is problematic because recursive references to attributes that are later overridden don't notice the override. Switched to the approach of giving mkDerivation a lambda that receives a self argument, which allows recursive references to the final value after overrides are applied. The related derivations (for export templates, headless, and server builds of godot) duplicated content from the base derivation. This refactor eliminated that by using overridable attributes to parameterize the scripts. The main motivation for this refactor was to help me add derivations for mono builds of godot. Renamed to godot3 to distinguish from version 4, which is a complete rewrite and effectively a different tool altogether.
29 lines
1.3 KiB
Nix
29 lines
1.3 KiB
Nix
{ godot3 }:
|
|
|
|
godot3.overrideAttrs (self: base: {
|
|
pname = "godot3-export-templates";
|
|
godotBuildDescription = "nix export templates";
|
|
|
|
# As described in default.nix, adding the link flags to pulseaudio in detect.py was necessary to
|
|
# allow the dlopen calls to succeed in Nix builds of godot. However, it seems that this *breaks*
|
|
# the export templates, resulting in programs exported from godot using these export templates to
|
|
# be unable to load this library.
|
|
shouldAddLinkFlagsToPulse = false;
|
|
|
|
shouldBuildTools = false;
|
|
godotBuildTarget = "release";
|
|
godotBinInstallPath = "share/godot/templates/${self.version}.stable";
|
|
installedGodotBinName = "linux_${self.godotBuildPlatform}_64_${self.godotBuildTarget}";
|
|
|
|
# https://docs.godotengine.org/en/stable/development/compiling/optimizing_for_size.html
|
|
# Stripping reduces the template size from around 500MB to 40MB for Linux.
|
|
# This also impacts the size of the exported games.
|
|
# This is added explicitly here because mkDerivation does not automatically
|
|
# strip binaries in the template directory.
|
|
stripAllList = (base.stripAllList or []) ++ [ "share/godot/templates" ];
|
|
|
|
meta = base.meta // {
|
|
homepage = "https://docs.godotengine.org/en/stable/development/compiling/compiling_for_x11.html#building-export-templates";
|
|
};
|
|
})
|