summary refs log tree commit diff
path: root/pkgs/applications/emulators/retroarch/wrapper.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/applications/emulators/retroarch/wrapper.nix')
-rw-r--r--pkgs/applications/emulators/retroarch/wrapper.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/pkgs/applications/emulators/retroarch/wrapper.nix b/pkgs/applications/emulators/retroarch/wrapper.nix
new file mode 100644
index 00000000000..e667afdf079
--- /dev/null
+++ b/pkgs/applications/emulators/retroarch/wrapper.nix
@@ -0,0 +1,37 @@
+{ stdenv, lib, makeWrapper, retroarch, cores ? [ ] }:
+
+stdenv.mkDerivation {
+  pname = "retroarch";
+  version = lib.getVersion retroarch;
+
+  nativeBuildInputs = [ makeWrapper ];
+
+  buildCommand = ''
+    mkdir -p $out/lib
+    for coreDir in $cores
+    do
+      ln -s $coreDir/* $out/lib/.
+    done
+
+    ln -s -t $out ${retroarch}/share
+
+    if [ -d ${retroarch}/Applications ]; then
+      ln -s -t $out ${retroarch}/Applications
+    fi
+
+    makeWrapper ${retroarch}/bin/retroarch $out/bin/retroarch \
+      --suffix-each LD_LIBRARY_PATH ':' "$cores" \
+      --add-flags "-L $out/lib/" \
+  '';
+
+  cores = map (x: x + x.libretroCore) cores;
+  preferLocalBuild = true;
+
+  meta = with retroarch.meta; {
+    inherit changelog license homepage platforms maintainers;
+    description = description
+      + " (with cores: "
+      + lib.concatStringsSep ", " (map (x: "${x.name}") cores)
+      + ")";
+  };
+}