@@ -0,0 +1,54 @@
1+{ lib, stdenv, fetchurl, unzip, makeWrapper }:
2+
3+stdenv.mkDerivation rec {
4+ pname = "inklecate";
5+ version = "1.0.0";
6+
7+ src =
8+ if stdenv.isLinux then
9+ fetchurl {
10+ url = "https://github.com/inkle/ink/releases/download/v${version}/inklecate_linux.zip";
11+ sha256 = "6e17db766222998ba0ae5a5da9857e34896e683b9ec42fad528c3f8bea7398ea";
12+ name = "${pname}-${version}";
13+ }
14+ else if stdenv.isDarwin then
15+ fetchurl {
16+ url = "https://github.com/inkle/ink/releases/download/v${version}/inklecate_mac.zip";
17+ sha256 = "b6f4dd1f95c180637ce193dbb5fa6d59aeafe49a2121a05b7822e6cbbaa6931f";
18+ name = "${pname}-${version}";
19+ }
20+ else throw "Not supported on ${stdenv.hostPlatform.system}.";
21+
22+ # Work around the "unpacker appears to have produced no directories"
23+ # case that happens when the archive doesn't have a subdirectory.
24+ setSourceRoot = "sourceRoot=$(pwd)";
25+
26+ nativeBuildInputs = [ unzip makeWrapper ];
27+
28+ unpackPhase = ''
29+ unzip -qq -j $src -d $pname-$version
30+
31+ rm $pname-$version/ink-engine-runtime.dll
32+ rm $pname-$version/ink_compiler.dll
33+ '';
34+
35+ installPhase = ''
36+ mkdir -p $out/bin/
37+
38+ cp $pname-$version/inklecate $out/bin/inklecate
39+ '';
40+
41+
42+ meta = with lib; {
43+ description = "Compiler for ink, inkle's scripting language";
44+ longDescription = ''
45+ Inklecate is a command-line compiler for ink, inkle's open source
46+ scripting language for writing interactive narrative
47+ '';
48+ homepage = "https://www.inklestudios.com/ink/";
49+ downloadPage = "https://github.com/inkle/ink/releases";
50+ license = licenses.mit;
51+ platforms = platforms.unix;
52+ maintainers = with maintainers; [ shreerammodi ];
53+ };
54+}