# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0

{ stdenv, fetchFromGitHub, glib, gimp, pkg-config, gdk-pixbuf, cairo, gtk2 }:

stdenv.mkDerivation rec {
  name = "gimp-plugin-vtf";
  version = "1.1";

  src = fetchFromGitHub {
    owner = "linux-source-tools";
    repo = "gimp-plugin-vtf";
    rev = version;
    sha256 = "1a9k1vwq224apahnzsrg26hfvycxylbw4269f6xyw3dr54nkbi7n";
  };

  installPhase = ''
    runHook preInstall
    mkdir -p $out/lib/gimp/2.0/plug-ins
    cp file-vtf $out/lib/gimp/2.0/plug-ins
    runHook postInstall
  '';

  buildInputs = [
    glib
    gdk-pixbuf
    gtk2
    gimp
    cairo
  ];
  nativeBuildInputs = [
    pkg-config
  ];
}