nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 fetchurl,
3 godot,
4 hash,
5 lib,
6 stdenvNoCC,
7 unzip,
8 version,
9 withMono ? false,
10}:
11# Export templates is necessary for setting up Godot engine, it's used when exporting projects.
12# Godot applications/games packages needs to reference export templates.
13# Export templates version should be kept in sync with Godot version.
14# https://docs.godotengine.org/en/stable/tutorials/export/exporting_projects.html#export-templates
15let
16 self = stdenvNoCC.mkDerivation {
17 pname = "godot-export-templates${lib.optionalString withMono "-mono"}-bin";
18 version = version;
19
20 src = fetchurl {
21 url = "https://github.com/godotengine/godot/releases/download/${version}/Godot_v${version}${lib.optionalString withMono "_mono"}_export_templates.tpz";
22 inherit hash;
23 };
24
25 nativeBuildInputs = [
26 unzip
27 ];
28
29 unpackPhase = ''
30 runHook preUnpack
31 unzip -q "$src"
32 runHook postUnpack
33 '';
34
35 installPhase = ''
36 templates="$out"/share/godot/export_templates
37 mkdir -p "$templates"
38 read version < templates/version.txt
39 mv templates "$templates/$version"
40 '';
41
42 meta = {
43 inherit (godot.meta)
44 changelog
45 description
46 homepage
47 license
48 maintainers
49 ;
50 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
51 };
52 };
53in
54self