about summary refs log tree commit diff
path: root/pkgs/applications/editors/pixelorama
diff options
context:
space:
mode:
authorrotaerk <m.scott.stewart@gmail.com>2022-09-11 20:05:50 -0400
committerrotaerk <m.scott.stewart@gmail.com>2023-07-30 18:46:07 -0400
commite138e656c7c3f7c25b62a73b9011f921563f4ee5 (patch)
tree8037f41b0925ad13509bc91158447945a8cc7ac7 /pkgs/applications/editors/pixelorama
parent07be8b4c3989dd451c1a54dc8ae00dcee3b8785f (diff)
godot3: refactor and rename from godot
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.
Diffstat (limited to 'pkgs/applications/editors/pixelorama')
-rw-r--r--pkgs/applications/editors/pixelorama/default.nix44
1 files changed, 39 insertions, 5 deletions
diff --git a/pkgs/applications/editors/pixelorama/default.nix b/pkgs/applications/editors/pixelorama/default.nix
index e883ba36d5fbd..868e2eeaaad9e 100644
--- a/pkgs/applications/editors/pixelorama/default.nix
+++ b/pkgs/applications/editors/pixelorama/default.nix
@@ -1,4 +1,21 @@
-{ lib, stdenv, fetchFromGitHub, godot-headless, godot-export-templates, nix-update-script }:
+{ lib
+, stdenv
+, alsa-lib
+, autoPatchelfHook
+, fetchFromGitHub
+, godot3-headless
+, godot3-export-templates
+, libGLU
+, libpulseaudio
+, libX11
+, libXcursor
+, libXi
+, libXinerama
+, libXrandr
+, libXrender
+, nix-update-script
+, udev
+}:
 
 let
   preset =
@@ -19,7 +36,18 @@ in stdenv.mkDerivation (finalAttrs: {
   };
 
   nativeBuildInputs = [
-    godot-headless
+    autoPatchelfHook
+    godot3-headless
+  ];
+
+  buildInputs = [
+    libGLU
+    libX11
+    libXcursor
+    libXi
+    libXinerama
+    libXrandr
+    libXrender
   ];
 
   buildPhase = ''
@@ -27,10 +55,10 @@ in stdenv.mkDerivation (finalAttrs: {
 
     export HOME=$(mktemp -d)
     mkdir -p $HOME/.local/share/godot/
-    ln -s "${godot-export-templates}/share/godot/templates" "$HOME/.local/share/godot/templates"
+    ln -s "${godot3-export-templates}/share/godot/templates" "$HOME/.local/share/godot/templates"
     mkdir -p build
-    godot-headless -v --export "${preset}" ./build/pixelorama
-    godot-headless -v --export-pack "${preset}" ./build/pixelorama.pck
+    godot3-headless -v --export "${preset}" ./build/pixelorama
+    godot3-headless -v --export-pack "${preset}" ./build/pixelorama.pck
 
     runHook postBuild
   '';
@@ -47,6 +75,12 @@ in stdenv.mkDerivation (finalAttrs: {
     runHook postInstall
   '';
 
+  runtimeDependencies = map lib.getLib [
+    alsa-lib
+    libpulseaudio
+    udev
+  ];
+
   passthru.updateScript = nix-update-script { };
 
   meta = with lib; {