@@ -0,0 +1,100 @@
1+{ lib, stdenv, fetchurl, fetchFromGitHub, nim, gentium, SDL2, makeDesktopItem }:
2+
3+let
4+ treeformLibs = lib.attrsets.mapAttrsToList (repo: args:
5+ fetchFromGitHub ({
6+ inherit repo;
7+ owner = "treeform";
8+ } // args)) {
9+ bumpy = {
10+ rev = "1.0.3";
11+ sha256 = "sha256-mDmDlhOGoYYjKgF5j808oT2NqRlfcOdLSDE3WtdJFQ0=";
12+ };
13+ chroma = {
14+ rev = "0.2.5";
15+ sha256 = "sha256-6lNHpO2aMorgkaPfo6kRcOs9r5R6T/kislVmkeoulw8=";
16+ };
17+ flatty = {
18+ rev = "0.2.1";
19+ sha256 = "sha256-TqNnRh2+i6n98ktLRVQxt9CVw17FGLNYq29rJoMus/0=";
20+ };
21+ pixie = {
22+ rev = "1.1.3";
23+ sha256 = "sha256-xKIejVxOd19mblL1ZwpJH91dgKQS5g8U08EL8lGGelA=";
24+ };
25+ typography = {
26+ rev = "0.7.9";
27+ sha256 = "sha256-IYjw3PCp5XzVed2fGGCt9Hb60cxFeF0BUZ7L5PedTLU=";
28+ };
29+ vmath = {
30+ rev = "1.0.3";
31+ sha256 = "sha256-zzSKXjuTZ46HTFUs0N47mxEKTKIdS3dwr+60sQYSdn0=";
32+ };
33+ };
34+
35+ nimLibs = treeformLibs ++ [
36+ (fetchFromGitHub {
37+ owner = "nim-lang";
38+ repo = "sdl2";
39+ rev = "v2.0.2";
40+ sha256 = "sha256-Ivx/gxDa2HVDjCVrJVu23i4d0pDzzv+ThmwqNjtkjsA=";
41+ })
42+ (fetchFromGitHub {
43+ owner = "guzba";
44+ repo = "nimsimd";
45+ rev = "1.0.0";
46+ sha256 = "sha256-kp61fylAJ6MSN9hLYLi7CU2lxVR/lbrNCvZTe0LJLGo=";
47+ })
48+ (fetchFromGitHub {
49+ owner = "guzba";
50+ repo = "zippy";
51+ rev = "0.5.6";
52+ sha256 = "sha256-axp4t9+8TFSpvnATlRKZyuOGLA0e/XKfvrVSwreXpC4=";
53+ })
54+ ];
55+
56+in stdenv.mkDerivation rec {
57+ pname = "hottext";
58+ version = "1.3";
59+
60+ src = fetchurl {
61+ url = "https://git.sr.ht/~ehmry/hottext/archive/v${version}.tar.gz";
62+ sha256 = "sha256-iz7Z2x0/yi/E6gGFkYgq/yZDOxrZGwQmumPoO9kckLQ=";
63+ };
64+
65+ nativeBuildInputs = [ nim ];
66+ buildInputs = [ SDL2 ];
67+
68+ nimFlags = [ "-d:release" ] ++ map (lib: "--path:${lib}/src") nimLibs;
69+
70+ HOTTEXT_FONT_PATH = "${gentium}/share/fonts/truetype/GentiumPlus-R.ttf";
71+
72+ buildPhase = ''
73+ runHook preBuild
74+ HOME=$TMPDIR
75+ nim $nimFlags compile src/$pname
76+ runHook postBuild
77+ '';
78+
79+ desktopItem = makeDesktopItem {
80+ categories = "Utility;";
81+ comment = meta.description;
82+ desktopName = pname;
83+ exec = pname;
84+ name = pname;
85+ };
86+
87+ installPhase = ''
88+ runHook preInstall
89+ install -Dt $out/bin src/$pname
90+ cp -r $desktopItem/* $out
91+ runHook postInstall
92+ '';
93+
94+ meta = with lib; {
95+ description = "Simple RSVP speed-reading utility";
96+ license = licenses.unlicense;
97+ homepage = "https://git.sr.ht/~ehmry/hottext";
98+ maintainers = with maintainers; [ ehmry ];
99+ };
100+}