nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 godot3-headless,
6 godot3-export-templates,
7 libglvnd,
8 libX11,
9 libXcursor,
10 libXext,
11 libXfixes,
12 libXi,
13 libXinerama,
14 libXrandr,
15 libXrender,
16 nix-update-script,
17}:
18
19stdenv.mkDerivation (finalAttrs: {
20 pname = "material-maker";
21 version = "1.3";
22
23 src = fetchFromGitHub {
24 owner = "RodZill4";
25 repo = "material-maker";
26 rev = finalAttrs.version;
27 hash = "sha256-vyagu7xL4ITt+xyoYyCcF8qq6L9sR6Ltdl6NwfrbZdA=";
28 };
29
30 nativeBuildInputs = [ godot3-headless ];
31
32 buildInputs = [
33 libglvnd
34
35 libXinerama
36 libXcursor
37 libXext
38 libXrandr
39 libXrender
40 libX11
41 libXi
42 libXfixes
43 ];
44
45 buildPhase = ''
46 runHook preBuild
47
48 export HOME=$TMPDIR
49
50 # Link the export-templates to the expected location. The --export commands
51 # expects the template-file at .../templates/{godot-version}.stable/linux_x11_64_release
52 mkdir -p $HOME/.local/share/godot
53 ln -s ${godot3-export-templates}/share/godot/templates $HOME/.local/share/godot
54
55 # Don't use the included export template, which might use a mismatched version of godot.
56 rm ./material_maker/misc/linux/godot.x11.opt.64
57 substituteInPlace ./export_presets.cfg \
58 --replace-fail '"material_maker/misc/linux/godot.x11.opt.64"' '""'
59
60 mkdir -vp build
61 godot3-headless -v --export 'Linux/X11' build/material-maker
62
63 runHook postBuild
64 '';
65
66 installPhase = ''
67 runHook preInstall
68
69 mkdir -vp $out/share/material-maker
70 cp -vr \
71 ./build/* \
72 ./addons/material_maker/nodes \
73 ./material_maker/environments \
74 ./material_maker/examples \
75 ./material_maker/library \
76 ./material_maker/meshes \
77 ./material_maker/misc/export \
78 $out/share/material-maker
79
80 mkdir -vp $out/bin
81 ln -vs $out/share/material-maker/material-maker $out/bin/material-maker
82
83 runHook postInstall
84 '';
85
86 fixupPhase = ''
87 runHook preFixup
88
89 patchelf \
90 --set-interpreter '${stdenv.cc.bintools.dynamicLinker}' \
91 --set-rpath ${lib.makeLibraryPath finalAttrs.buildInputs} \
92 $out/share/material-maker/material-maker
93
94 runHook postFixup
95 '';
96
97 passthru.updateScript = nix-update-script { };
98
99 meta = {
100 description = "Procedural materials authoring tool";
101 mainProgram = "material-maker";
102 homepage = "https://www.materialmaker.org";
103 license = lib.licenses.mit;
104 platforms = [ "x86_64-linux" ];
105 maintainers = with lib.maintainers; [ lelgenio ];
106 };
107})