nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ stdenv
2, lib
3, fetchFromGitHub
4, fetchurl
5, cmake
6, makeWrapper
7, copyDesktopItems
8, makeDesktopItem
9, physfs
10, SDL2
11, SDL2_mixer
12, tinyxml-2
13, utf8cpp
14, Foundation
15, IOKit
16, makeAndPlay ? false
17}:
18
19stdenv.mkDerivation rec {
20 pname = "vvvvvv";
21 version = "2.3.6";
22
23 src = fetchFromGitHub {
24 owner = "TerryCavanagh";
25 repo = "VVVVVV";
26 rev = version;
27 sha256 = "sha256-sLNO4vkmlirsqJmCV9YWpyNnIiigU1KMls7rOgWgSmQ=";
28 };
29 sourceRoot = "source/desktop_version";
30 dataZip = fetchurl {
31 url = "https://thelettervsixtim.es/makeandplay/data.zip";
32 name = "data.zip";
33 sha256 = "sha256-x2eAlZT2Ry2p9WE252ZX44ZA1YQWSkYRIlCsYpPswOo=";
34 meta.license = lib.licenses.unfree;
35 };
36
37 nativeBuildInputs = [
38 cmake
39 makeWrapper
40 copyDesktopItems
41 ];
42
43 buildInputs = [
44 physfs
45 SDL2
46 SDL2_mixer
47 tinyxml-2
48 utf8cpp
49 ] ++ lib.optionals stdenv.isDarwin [ Foundation IOKit ];
50
51 # Help CMake find SDL_mixer.h
52 env.NIX_CFLAGS_COMPILE = "-I${lib.getDev SDL2_mixer}/include/SDL2";
53
54 cmakeFlags = [ "-DBUNDLE_DEPENDENCIES=OFF" ] ++ lib.optional makeAndPlay "-DMAKEANDPLAY=ON";
55
56 desktopItems = [
57 (makeDesktopItem {
58 type = "Application";
59 name = "VVVVVV";
60 desktopName = "VVVVVV";
61 comment = meta.description;
62 exec = pname;
63 icon = "VVVVVV";
64 terminal = false;
65 categories = [ "Game" ];
66 })
67 ];
68
69 installPhase = ''
70 runHook preInstall
71
72 install -Dm755 VVVVVV $out/bin/${pname}
73 install -Dm644 "$src/desktop_version/icon.ico" "$out/share/pixmaps/VVVVVV.png"
74
75 wrapProgram $out/bin/${pname} --add-flags "-assets ${dataZip}"
76
77 runHook postInstall
78 '';
79
80 meta = with lib; {
81 description = "A retro-styled platform game" + lib.optionalString makeAndPlay " (redistributable, without original levels)";
82 longDescription = ''
83 VVVVVV is a platform game all about exploring one simple mechanical
84 idea - what if you reversed gravity instead of jumping?
85 '' + lib.optionalString makeAndPlay ''
86 (Redistributable version, doesn't include the original levels.)
87 '';
88 homepage = "https://thelettervsixtim.es";
89 license = licenses.unfree;
90 maintainers = with maintainers; [ martfont ];
91 platforms = platforms.unix;
92 };
93}