diff options
author | AndersonTorres <torres.anderson.85@protonmail.com> | 2021-10-03 03:17:26 -0300 |
---|---|---|
committer | AndersonTorres <torres.anderson.85@protonmail.com> | 2021-10-03 03:31:30 -0300 |
commit | 24f04ee6bb3689a7860dfc7130082c1ad7d733a7 (patch) | |
tree | 05a3d19452f1a9f9d455793ae068ba5bdbee2a29 /pkgs/development/interpreters/bqn | |
parent | 18e178040a8c3278da222ff9f8f15b9d44f0e569 (diff) |
mbqn: init at 0.0.0+unstable=2021-10-01
Diffstat (limited to 'pkgs/development/interpreters/bqn')
-rw-r--r-- | pkgs/development/interpreters/bqn/mlochbaum-bqn/001-libbqn-path.patch | 12 | ||||
-rw-r--r-- | pkgs/development/interpreters/bqn/mlochbaum-bqn/default.nix | 64 |
2 files changed, 76 insertions, 0 deletions
diff --git a/pkgs/development/interpreters/bqn/mlochbaum-bqn/001-libbqn-path.patch b/pkgs/development/interpreters/bqn/mlochbaum-bqn/001-libbqn-path.patch new file mode 100644 index 0000000000000..b23c3de44af6d --- /dev/null +++ b/pkgs/development/interpreters/bqn/mlochbaum-bqn/001-libbqn-path.patch @@ -0,0 +1,12 @@ +diff -Naur source-old/bqn.js source-new/bqn.js +--- source-old/bqn.js 1969-12-31 21:00:01.000000000 -0300 ++++ source-new/bqn.js 2021-10-03 01:28:00.268998916 -0300 +@@ -4,7 +4,7 @@ + let path = require('path'); + let fs = require('fs'); + +-let bqn = require("./docs/bqn.js"); ++let bqn = require("@libbqn@"); + module.exports = bqn; + let {fmt,fmtErr,sysvals,sysargs,makebqn,makerepl}=bqn; + let {has,list,str,unstr,dynsys,req1str,makens}=bqn.util; diff --git a/pkgs/development/interpreters/bqn/mlochbaum-bqn/default.nix b/pkgs/development/interpreters/bqn/mlochbaum-bqn/default.nix new file mode 100644 index 0000000000000..8a280ad921b2c --- /dev/null +++ b/pkgs/development/interpreters/bqn/mlochbaum-bqn/default.nix @@ -0,0 +1,64 @@ +{ lib +, stdenvNoCC +, fetchFromGitHub +, makeWrapper +, nodejs +}: + +stdenvNoCC.mkDerivation rec { + pname = "bqn"; + version = "0.0.0+unstable=2021-10-01"; + + src = fetchFromGitHub { + owner = "mlochbaum"; + repo = "BQN"; + rev = "b3d68f730d48ccb5e3b3255f9010c95bf9f86e22"; + hash = "sha256-Tkgwz7+d25svmjRsXFUQq0S/73QJU+BKSNeGqpUcBTQ="; + }; + + nativeBuildInputs = [ makeWrapper ]; + + buildInputs = [ nodejs ]; + + patches = [ + # Creates a @libbqn@ substitution variable + ./001-libbqn-path.patch + ]; + + dontConfigure = true; + + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir -p $out/bin $out/share/${pname} + cp bqn.js $out/share/${pname}/bqn.js + cp docs/bqn.js $out/share/${pname}/libbqn.js + + makeWrapper "${lib.getBin nodejs}/bin/node" "$out/bin/mbqn" \ + --add-flags "$out/share/${pname}/bqn.js" + + ln -s $out/bin/mbqn $out/bin/bqn + + runHook postInstall + ''; + + fixupPhase = '' + runHook preFixup + + substituteInPlace $out/share/${pname}/bqn.js \ + --subst-var-by "libbqn" "$out/share/${pname}/libbqn.js" + + runHook postFixup + ''; + + meta = with lib; { + homepage = "https://github.com/mlochbaum/BQN/"; + description = "The original BQN implementation in Javascript"; + license = licenses.isc; + maintainers = with maintainers; [ AndersonTorres ]; + platforms = platforms.all; + }; +} +# TODO: install docs and other stuff |