1{
2 lib,
3 stdenv,
4 fetchurl,
5 fetchFromSourcehut,
6 installShellFiles,
7 makeBinaryWrapper,
8 gv,
9}:
10
11stdenv.mkDerivation rec {
12 pname = "klong";
13 version = "20221212";
14
15 src = fetchurl {
16 url = "https://t3x.org/klong/klong${version}.tgz";
17 hash = "sha256-XhpIdyKKPGQ6mdv9LXPmC8P6hW4mFawv54yANw5/lrQ=";
18 };
19
20 docs = fetchFromSourcehut {
21 owner = "~nut";
22 repo = "klong-docs";
23 rev = "350da558709e3728df60ddf45fafe09e3fb89139";
24 hash = "sha256-yfvXljjJwCETWPa70zXhaQJOHhZYR2k+BKAd0Dw/U70=";
25 };
26
27 nativeBuildInputs = [
28 makeBinaryWrapper
29 installShellFiles
30 ];
31
32 installPhase = ''
33 runHook preInstall
34 install -m 555 -Dt $out/bin kg kplot
35 install -m 444 -Dt $out/lib/klong lib/*.kg
36 runHook postInstall
37 '';
38
39 postInstall = ''
40 wrapProgram $out/bin/kg --prefix KLONGPATH : $out/lib/klong
41 wrapProgram $out/bin/kplot --prefix PATH : ${
42 lib.makeBinPath [
43 "$out"
44 gv
45 ]
46 }
47 installManPage $docs/*.1
48 '';
49
50 meta = {
51 description = "Simple Array programming language";
52 homepage = "https://t3x.org/klong";
53 mainProgram = "kg";
54 maintainers = [ lib.maintainers.casaca ];
55 platforms = lib.platforms.all;
56 license = with lib.licenses; [
57 publicDomain
58 cc0
59 ];
60 };
61}