@@ -0,0 +1,52 @@
1+{ stdenv, fetchFromGitHub, fetchpatch
2+, SDL2, SDL2_image
3+, pkgconfig
4+}:
5+
6+stdenv.mkDerivation rec {
7+ pname = "klystrack";
8+ version = "1.7.6";
9+
10+ src = fetchFromGitHub {
11+ owner = "kometbomb";
12+ repo = pname;
13+ rev = version;
14+ fetchSubmodules = true;
15+ sha256 = "1h99sm2ddaq483hhk2s3z4bjbgn0d2h7qna7l7qq98wvhqix8iyz";
16+ };
17+
18+ buildInputs = [
19+ SDL2 SDL2_image
20+ ];
21+ nativeBuildInputs = [ pkgconfig ];
22+
23+ patches = [
24+ (fetchpatch {
25+ url = "https://github.com/kometbomb/klystrack/commit/bb537595d02140176831c4a1b8e9121978b32d22.patch";
26+ sha256 = "06gl9q0jwg039kpxb13lg9x0k59s11968qn4lybgkadvzmhxkgmi";
27+ })
28+ ];
29+
30+ buildFlags = [ "PREFIX=${placeholder "out"}" "CFG=release" ];
31+
32+ installPhase = ''
33+ install -Dm755 bin.release/klystrack $out/bin/klystrack
34+
35+ mkdir -p $out/lib/klystrack
36+ cp -R res $out/lib/klystrack
37+ cp -R key $out/lib/klystrack
38+
39+ install -DT icon/256x256.png $out/share/icons/hicolor/256x256/apps/klystrack.png
40+ mkdir -p $out/share/applications
41+ substitute linux/klystrack.desktop $out/share/applications/klystrack.desktop \
42+ --replace "klystrack %f" "$out/bin/klystrack %f"
43+ '';
44+
45+ meta = with stdenv.lib; {
46+ description = "A chiptune tracker";
47+ homepage = "https://kometbomb.github.io/klystrack";
48+ license = licenses.mit;
49+ maintainers = with maintainers; [ suhr ];
50+ platforms = platforms.linux;
51+ };
52+}