about summary refs log tree commit diff
path: root/pkgs/by-name/th/the-powder-toy/package.nix
blob: 25da4e5d881831d8b5256d8ab08845ba1cfcb324 (plain) (blame)
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
71
72
73
74
75
{
  bzip2,
  Cocoa,
  copyDesktopItems,
  curl,
  fetchFromGitHub,
  fftwFloat,
  jsoncpp,
  lib,
  libpng,
  lua,
  luajit,
  meson,
  ninja,
  pkg-config,
  SDL2,
  stdenv,
  zlib,
}:
stdenv.mkDerivation rec {
  pname = "the-powder-toy";
  version = "98.2.365";

  src = fetchFromGitHub {
    owner = "The-Powder-Toy";
    repo = "The-Powder-Toy";
    rev = "refs/tags/v${version}";
    hash = "sha256-S2aUa25EnUfX6ShW6D+wHrsTLxTcCFcZ/uLE9EWGu4Q=";
  };

  nativeBuildInputs = [
    meson
    ninja
    pkg-config
  ] ++ lib.optional stdenv.isLinux copyDesktopItems;

  buildInputs = [
    bzip2
    curl
    fftwFloat
    jsoncpp
    libpng
    lua
    luajit
    SDL2
    zlib
  ] ++ lib.optional stdenv.isDarwin Cocoa;

  mesonFlags = [ "-Dworkaround_elusive_bzip2=false" ];

  installPhase = ''
    runHook preInstall

    install -Dm 755 powder $out/bin/powder

    mkdir -p $out/share
    mv ../resources $out/share

    runHook postInstall
  '';

  desktopItems = [ "resources/powder.desktop" ];

  meta = with lib; {
    description = "Free 2D physics sandbox game";
    homepage = "https://powdertoy.co.uk/";
    platforms = platforms.unix;
    license = licenses.gpl3Plus;
    maintainers = with maintainers; [
      abbradar
      siraben
    ];
    mainProgram = "powder";
  };
}