nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitea,
5 runtimeShell,
6}:
7
8stdenv.mkDerivation {
9 pname = "ngn-k";
10 version = "0-unstable-2025-01-04";
11
12 src = fetchFromGitea {
13 domain = "codeberg.org";
14 owner = "ngn";
15 repo = "k";
16 rev = "feb51a61443dac03213c4e97edd8df679a4a3aaa";
17 sha256 = "14v2bwbgaxi1rsq5xabp5dmv0bl0vga3lhzwdxyvsyl9q7qybf55";
18 };
19
20 patches = [
21 ./repl-license-path.patch
22 ./repl-argv-1.patch
23 ];
24
25 postPatch = ''
26 # don't use hardcoded /bin/sh
27 for f in repl.k m.c;do
28 substituteInPlace "$f" --replace-fail "/bin/sh" "${runtimeShell}"
29 done
30 '';
31
32 makeFlags = [ "-e" ];
33 buildFlags = [
34 "k"
35 "libk.so"
36 ];
37 checkTarget = "t";
38
39 outputs = [
40 "out"
41 "dev"
42 "lib"
43 ];
44
45 # TODO(@sternenseemann): package bulgarian translation
46 installPhase = ''
47 runHook preInstall
48 install -Dm755 k "$out/bin/k"
49 install -Dm755 repl.k "$out/bin/k-repl"
50 install -Dm755 libk.so "$lib/lib/libk.so"
51 install -Dm644 k.h "$dev/include/k.h"
52 install -Dm644 LICENSE -t "$out/share/ngn-k"
53 substituteInPlace "$out/bin/k-repl" --replace-fail "#!k" "#!$out/bin/k"
54 runHook postInstall
55 '';
56
57 meta = {
58 description = "Simple fast vector programming language";
59 homepage = "https://codeberg.org/ngn/k";
60 license = lib.licenses.agpl3Only;
61 maintainers = [ lib.maintainers.sternenseemann ];
62 platforms = [
63 "x86_64-linux"
64 "x86_64-freebsd"
65 ];
66 };
67}