mirror of
https://github.com/SebastianWendel/nixpkgs.git
synced 2024-09-21 12:59:04 +02:00
ngn-k: init at unstable-2021-08-30
This commit is contained in:
parent
d90b2fc264
commit
5b01ba1bc0
61
pkgs/development/interpreters/ngn-k/default.nix
Normal file
61
pkgs/development/interpreters/ngn-k/default.nix
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
{ lib
|
||||||
|
, stdenv
|
||||||
|
, stdenvNoLibs
|
||||||
|
, fetchFromGitea
|
||||||
|
, runtimeShell
|
||||||
|
, doCheck ? stdenv.hostPlatform == stdenv.buildPlatform
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
# k itself is compiled with -ffreestanding, but tests require a libc
|
||||||
|
useStdenv = if doCheck then stdenv else stdenvNoLibs;
|
||||||
|
in
|
||||||
|
|
||||||
|
useStdenv.mkDerivation {
|
||||||
|
pname = "ngn-k";
|
||||||
|
version = "unstable-2021-08-30";
|
||||||
|
|
||||||
|
src = fetchFromGitea {
|
||||||
|
domain = "codeberg.org";
|
||||||
|
owner = "ngn";
|
||||||
|
repo = "k";
|
||||||
|
rev = "3e2bcb81c723e268015818570f2805547114b5dd";
|
||||||
|
sha256 = "0b16971xgf0sgx7qf41dilrpz02jnas61gfwkyvbxv18874w5vap";
|
||||||
|
};
|
||||||
|
|
||||||
|
patches = [
|
||||||
|
./repl-license-path.patch
|
||||||
|
];
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
# make self-reference for LICENSE
|
||||||
|
substituteAllInPlace repl.k
|
||||||
|
|
||||||
|
# don't use hardcoded /bin/sh
|
||||||
|
for f in repl.k m.c;do
|
||||||
|
substituteInPlace "$f" --replace "/bin/sh" "${runtimeShell}"
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
|
||||||
|
makeFlags = [ "-e" ];
|
||||||
|
buildFlags = [ "k" ];
|
||||||
|
checkTarget = "t";
|
||||||
|
inherit doCheck;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
install -Dm755 k "$out/bin/k"
|
||||||
|
install -Dm755 repl.k "$out/bin/k-repl"
|
||||||
|
install -Dm644 LICENSE -t "$out/share/ngn-k"
|
||||||
|
substituteInPlace "$out/bin/k-repl" --replace "#!k" "#!$out/bin/k"
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "A simple fast vector programming language";
|
||||||
|
homepage = "https://codeberg.org/ngn/k";
|
||||||
|
license = lib.licenses.agpl3Only;
|
||||||
|
maintainers = [ lib.maintainers.sternenseemann ];
|
||||||
|
platforms = [ "x86_64-linux" "x86_64-freebsd" ];
|
||||||
|
};
|
||||||
|
}
|
14
pkgs/development/interpreters/ngn-k/repl-license-path.patch
Normal file
14
pkgs/development/interpreters/ngn-k/repl-license-path.patch
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
diff --git a/repl.k b/repl.k
|
||||||
|
index e4071e6..70ae276 100755
|
||||||
|
--- a/repl.k
|
||||||
|
+++ b/repl.k
|
||||||
|
@@ -3,8 +3,7 @@ repl.banner:"ngn/k, (c) 2019-2021 ngn, GNU AGPLv3. type \\ for more info\n"
|
||||||
|
repl.prompt:," "
|
||||||
|
repl.cmds:""!()
|
||||||
|
repl.cmds["vf"]:{` 0:($!h),'":",'`k'. h:(&(x~"v")=^`o`p`q`r`u`v`w?@'h)#h:``repl_.:0#`}
|
||||||
|
-repl.cmds["a"]:{` 1:1:repl.basename[`argv 0],"/LICENSE";}
|
||||||
|
-repl.basename:{$[#x:"/"/-1_"/"\x;x;,"."]}
|
||||||
|
+repl.cmds["a"]:{` 1:1:"@out@/share/ngn-k/LICENSE";}
|
||||||
|
repl.fmt:{$[x~(::);"";(`A~@x)&1<#x;"(",("\n "/`k'x),")\n";`k[x],"\n"]}
|
||||||
|
repl.line:{$[#x;;:0];x:-1_x;$[(3>#x)&("\\"=*x)&~^(!repl.cmds)?x 1;repl.cmds[x 1]x 1;.[` 1:repl.fmt@.:;,x;`epr@]];` 1:repl.prompt;1}
|
||||||
|
{repl.cmds[x[1]1]:{y;` 0:x}2_x}'{(&x~\:80#"-")_x:(1+*&x~\:,"/")_-1_x}@0:`argv 1;
|
|
@ -12739,6 +12739,8 @@ with pkgs;
|
||||||
|
|
||||||
mujs = callPackage ../development/interpreters/mujs { };
|
mujs = callPackage ../development/interpreters/mujs { };
|
||||||
|
|
||||||
|
ngn-k = callPackage ../development/interpreters/ngn-k { };
|
||||||
|
|
||||||
octave = callPackage ../development/interpreters/octave {
|
octave = callPackage ../development/interpreters/octave {
|
||||||
python = python3;
|
python = python3;
|
||||||
mkDerivation = stdenv.mkDerivation;
|
mkDerivation = stdenv.mkDerivation;
|
||||||
|
|
Loading…
Reference in a new issue