about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorLinus Heckemann <git@sphalerite.org>2020-05-04 22:56:39 +0200
committerLinus Heckemann <git@sphalerite.org>2020-05-04 22:56:39 +0200
commitf62e2b24c32bf9de26ea96a4891ab0cbe6b392f9 (patch)
tree16b3a2d443a63d3eed5f4058e5de61aefc7931c2 /pkgs
parent32e4d072a0d8d378d9c3a18a94541c1d320bad61 (diff)
downloadnixlib-f62e2b24c32bf9de26ea96a4891ab0cbe6b392f9.tar
nixlib-f62e2b24c32bf9de26ea96a4891ab0cbe6b392f9.tar.gz
nixlib-f62e2b24c32bf9de26ea96a4891ab0cbe6b392f9.tar.bz2
nixlib-f62e2b24c32bf9de26ea96a4891ab0cbe6b392f9.tar.lz
nixlib-f62e2b24c32bf9de26ea96a4891ab0cbe6b392f9.tar.xz
nixlib-f62e2b24c32bf9de26ea96a4891ab0cbe6b392f9.tar.zst
nixlib-f62e2b24c32bf9de26ea96a4891ab0cbe6b392f9.zip
superTuxKart: use assets directly from download
This saves ~600MiB per STK build, as long as the assets remain the same.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/games/super-tux-kart/default.nix22
1 files changed, 14 insertions, 8 deletions
diff --git a/pkgs/games/super-tux-kart/default.nix b/pkgs/games/super-tux-kart/default.nix
index dcf1081e4d0b..70c5657508bd 100644
--- a/pkgs/games/super-tux-kart/default.nix
+++ b/pkgs/games/super-tux-kart/default.nix
@@ -1,9 +1,15 @@
-{ stdenv, fetchFromGitHub, fetchsvn, cmake, pkgconfig
+{ stdenv, fetchFromGitHub, fetchsvn, cmake, pkgconfig, makeWrapper
 , openal, freealut, libGLU, libGL, libvorbis, libogg, gettext, curl, freetype
 , fribidi, libtool, bluez, libjpeg, libpng, zlib, libX11, libXrandr, enet, harfbuzz }:
 
 let
   dir = "stk-code";
+  assets = fetchsvn {
+    url    = "https://svn.code.sf.net/p/supertuxkart/code/stk-assets";
+    rev    = "18212";
+    sha256 = "1dyj8r5rfifhnhayga8w8irkpa99vw57xjmy74cp8xz8g7zvdzqf";
+    name   = "stk-assets";
+  };
 
 in stdenv.mkDerivation rec {
   pname = "supertuxkart";
@@ -17,15 +23,9 @@ in stdenv.mkDerivation rec {
       sha256 = "01vxxl94583ixswzmi4caz8dk64r56pn3zxh7v63zml60yfvxbvp";
       name   = dir;
     })
-    (fetchsvn {
-      url    = "https://svn.code.sf.net/p/supertuxkart/code/stk-assets";
-      rev    = "18212";
-      sha256 = "1dyj8r5rfifhnhayga8w8irkpa99vw57xjmy74cp8xz8g7zvdzqf";
-      name   = "stk-assets";
-    })
   ];
 
-  nativeBuildInputs = [ cmake gettext libtool pkgconfig ];
+  nativeBuildInputs = [ cmake gettext libtool pkgconfig makeWrapper ];
 
   buildInputs = [
     libX11 libXrandr
@@ -38,8 +38,14 @@ in stdenv.mkDerivation rec {
   cmakeFlags = [
     "-DBUILD_RECORDER=OFF"         # libopenglrecorder is not in nixpkgs
     "-DUSE_SYSTEM_ANGELSCRIPT=OFF" # doesn't work with 2.31.2 or 2.32.0
+    "-DCHECK_ASSETS=OFF"
   ];
 
+  # Obtain the assets directly from the fetched store path, to avoid duplicating assets across multiple engine builds
+  preFixup = ''
+    wrapProgram $out/bin/supertuxkart --set-default SUPERTUXKART_ASSETS_DIR "${assets}"
+  '';
+
   sourceRoot = dir;
 
   meta = with stdenv.lib; {