about summary refs log tree commit diff
path: root/pkgs/applications/graphics/goxel/default.nix
blob: 000fd3719263ffdede1fceda6fc49298eb578016 (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
{ lib, stdenv, fetchFromGitHub, scons, pkg-config, wrapGAppsHook
, glfw3, gtk3, libpng }:

stdenv.mkDerivation (finalAttrs: {
  pname = "goxel";
  version = "0.14.0";

  src = fetchFromGitHub {
    owner = "guillaumechereau";
    repo = "goxel";
    rev = "v${finalAttrs.version}";
    hash = "sha256-ueA0YW2n/DXd9AytDzfPtvtXbvuUm4VDwcdvHWObKxc=";
  };

  nativeBuildInputs = [ scons pkg-config wrapGAppsHook ];
  buildInputs = [ glfw3 gtk3 libpng ];

  buildPhase = ''
    make release
  '';

  installPhase = ''
    install -D ./goxel $out/bin/goxel

    for res in $(ls data/icons | sed -e 's/icon//g' -e 's/.png//g'); do
      install -Dm444 data/icons/icon$res.png $out/share/icons/hicolor/''${res}x''${res}/apps/goxel.png
    done

    install -Dm444 snap/gui/goxel.desktop -t $out/share/applications
    substituteInPlace $out/share/applications/goxel.desktop \
      --replace 'Icon=''${SNAP}/icon.png' 'Icon=goxel'
  '';

  meta = with lib; {
    description = "Open Source 3D voxel editor";
    mainProgram = "goxel";
    homepage = "https://guillaumechereau.github.io/goxel/";
    license = licenses.gpl3;
    platforms = platforms.linux;
    maintainers = with maintainers; [ tilpner fgaz ];
  };
})