about summary refs log tree commit diff
path: root/nixpkgs/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix')
-rw-r--r--nixpkgs/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix31
1 files changed, 20 insertions, 11 deletions
diff --git a/nixpkgs/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix b/nixpkgs/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
index 7db79012ec65..93f51df1819d 100644
--- a/nixpkgs/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
+++ b/nixpkgs/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
@@ -1,8 +1,9 @@
-{ pkgs, stdenv, dwarf-therapist, dwarf-fortress, makeWrapper }:
+{ stdenv, dwarf-therapist, dwarf-fortress, substituteAll, coreutils, wrapQtAppsHook }:
 
 let
-  platformSlug = if stdenv.targetPlatform.is32bit then
-    "linux32" else "linux64";
+  platformSlug =
+    if stdenv.targetPlatform.is32bit then
+      "linux32" else "linux64";
   inifile = "linux/v0.${dwarf-fortress.baseVersion}.${dwarf-fortress.patchVersion}_${platformSlug}.ini";
 
 in
@@ -10,24 +11,32 @@ in
 stdenv.mkDerivation {
   name = "dwarf-therapist-${dwarf-therapist.version}";
 
-  wrapper = ./dwarf-therapist.in;
+  wrapper = substituteAll {
+    src = ./dwarf-therapist.in;
+    stdenv_shell = "${stdenv.shell}";
+    rm = "${coreutils}/bin/rm";
+    ln = "${coreutils}/bin/ln";
+    cat = "${coreutils}/bin/cat";
+    mkdir = "${coreutils}/bin/mkdir";
+    dirname = "${coreutils}/bin/dirname";
+    therapist = "${dwarf-therapist}";
+  };
 
   paths = [ dwarf-therapist ];
 
-  nativeBuildInputs = [ makeWrapper ];
+  nativeBuildInputs = [ wrapQtAppsHook ];
 
   passthru = { inherit dwarf-fortress dwarf-therapist; };
 
   buildCommand = ''
     mkdir -p $out/bin
+
+    install -Dm755 $wrapper $out/bin/dwarftherapist
     ln -s $out/bin/dwarftherapist $out/bin/DwarfTherapist
-    substitute $wrapper $out/bin/dwarftherapist \
-      --subst-var-by stdenv_shell ${stdenv.shell} \
-      --subst-var-by install $out \
-      --subst-var-by therapist ${dwarf-therapist} \
-      --subst-var-by qt_plugin_path "${pkgs.qt5.qtbase}/lib/qt-${pkgs.qt5.qtbase.qtCompatVersion}/plugins/platforms"
 
-    chmod 755 $out/bin/dwarftherapist
+    substituteInPlace $out/bin/dwarftherapist \
+      --subst-var-by install $out
+    wrapQtApp $out/bin/dwarftherapist
 
     # Fix up memory layouts
     rm -rf $out/share/dwarftherapist/memory_layouts/linux