2021-10-04 12:37:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenvNoCC
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, nodejs
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenvNoCC.mkDerivation rec {
|
|
|
|
pname = "bqn";
|
2022-10-21 18:38:19 +00:00
|
|
|
version = "0.pre+date=2022-10-03";
|
2021-10-04 12:37:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mlochbaum";
|
|
|
|
repo = "BQN";
|
2022-10-21 18:38:19 +00:00
|
|
|
rev = "1518205cceeb1fef27c584d24e92b189ffd234f4";
|
|
|
|
hash = "sha256:1pyk331ymbs2fv9jxmbv28yvk9mr2mcni1dsja6fzkk1jrd767hy";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
buildInputs = [ nodejs ];
|
|
|
|
|
|
|
|
patches = [
|
2021-10-07 14:46:35 +00:00
|
|
|
# Creates a @libbqn@ substitution variable, to be filled in the fixupPhase
|
2021-10-04 12:37:57 +00:00
|
|
|
./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
|