1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
{ lib
, stdenv
, fetchFromGitHub
, fetchsvn
, pkg-config
, sconsPackages
, libGLU
, libGL
, SDL2
, SDL2_image
, libvorbis
, bullet
, curl
, gettext
, writeShellScriptBin
, data ? fetchsvn {
url = "svn://svn.code.sf.net/p/vdrift/code/vdrift-data";
rev = "1446";
sha256 = "sha256-KEu49GAOfenPyuaUItt6W9pkuqUNpXgmTSFuc7ThljQ=";
}
}:
let
version = "unstable-2021-09-05";
bin = stdenv.mkDerivation {
pname = "vdrift";
inherit version;
src = fetchFromGitHub {
owner = "vdrift";
repo = "vdrift";
rev = "7e9e00c8612b2014d491f026dd86b03f9fb04dcd";
sha256 = "sha256-DrzRF4WzwEXCNALq0jz8nHWZ1oYTEsdrvSYVYI1WkTI=";
};
nativeBuildInputs = [ pkg-config sconsPackages.scons_latest ];
buildInputs = [ libGLU libGL SDL2 SDL2_image libvorbis bullet curl gettext ];
patches = [
./0001-Ignore-missing-data-for-installation.patch
];
buildPhase = ''
sed -i -e s,/usr/local,$out, SConstruct
export CXXFLAGS="$(pkg-config --cflags SDL2_image)"
scons -j$NIX_BUILD_CORES
'';
installPhase = "scons install";
meta = {
description = "Car racing game";
homepage = "http://vdrift.net/";
license = lib.licenses.gpl2Plus;
maintainers = with lib.maintainers; [ viric ];
platforms = lib.platforms.linux;
};
};
wrappedName = "vdrift-${version}-with-data-${toString data.rev}";
in
(writeShellScriptBin "vdrift" ''
export VDRIFT_DATA_DIRECTORY="${data}"
exec ${bin}/bin/vdrift "$@"
'').overrideAttrs (_: {
name = wrappedName;
meta = bin.meta // {
hydraPlatforms = [ ];
};
unwrapped = bin;
inherit bin data;
})
|