nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 SDL,
7 SDL_ttf,
8 SDL_image,
9 libSM,
10 libICE,
11 libGLU,
12 libGL,
13 libpng,
14 lua5,
15 autoconf,
16 automake,
17 mesa,
18}:
19
20stdenv.mkDerivation rec {
21 pname = "gravit";
22 version = "0.5.1";
23
24 src = fetchFromGitHub {
25 owner = "gak";
26 repo = "gravit";
27 rev = version;
28 hash = "sha256-JuqnLLD5+Ec8kQI0SK98V1O6TTbGM6+yKn5KCHe85eM=";
29 };
30
31 patches = [
32 # Pull fix pending upstream inclusion for -fno-common toolchains:
33 # https://github.com/gak/gravit/pull/100
34 (fetchpatch {
35 name = "fno-common.patch";
36 url = "https://github.com/gak/gravit/commit/0f848834889212f16201fd404d2d5b9bb5b47d23.patch";
37 hash = "sha256-k1aMIg7idMt53o6dFgIKJflOMp0Jp5NwgWEijcIwXrQ=";
38 })
39 ];
40
41 buildInputs = [
42 libGLU
43 libGL
44 SDL
45 SDL_ttf
46 SDL_image
47 lua5
48 libpng
49 libSM
50 libICE
51 ];
52
53 nativeBuildInputs = [
54 autoconf
55 automake
56 ];
57
58 preConfigure = ''
59 ./autogen.sh
60
61 # Build fails on Linux with windres.
62 export ac_cv_prog_WINDRES=
63 '';
64
65 enableParallelBuilding = true;
66
67 meta = {
68 broken = (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
69 homepage = "https://github.com/gak/gravit";
70 description = "Beautiful OpenGL-based gravity simulator";
71 mainProgram = "gravit";
72 license = lib.licenses.gpl2Plus;
73
74 longDescription = ''
75 Gravit is a gravity simulator which runs under Linux, Windows and
76 macOS. It uses Newtonian physics using the Barnes-Hut N-body
77 algorithm. Although the main goal of Gravit is to be as accurate
78 as possible, it also creates beautiful looking gravity patterns.
79 It records the history of each particle so it can animate and
80 display a path of its travels. At any stage you can rotate your
81 view in 3D and zoom in and out.
82 '';
83
84 inherit (mesa.meta) platforms;
85 hydraPlatforms = lib.platforms.linux; # darwin times out
86 };
87}