2021-10-04 12:37:57 +00:00
|
|
|
{ lib
|
|
|
|
, stdenvNoCC
|
|
|
|
, fetchFromGitHub
|
|
|
|
, makeWrapper
|
|
|
|
, nodejs
|
|
|
|
}:
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
2021-10-04 12:37:57 +00:00
|
|
|
pname = "bqn";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "0-unstable-2024-05-13";
|
2021-10-04 12:37:57 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mlochbaum";
|
|
|
|
repo = "BQN";
|
2024-06-05 15:53:02 +00:00
|
|
|
rev = "c971a177421d532a13c4b7515535552df19681e1";
|
|
|
|
hash = "sha256-Fru1IIb4IxBQxrEEBoRYStxBqYJJqd+Q+Hwyk++QA68=";
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
buildInputs = [ nodejs ];
|
|
|
|
|
|
|
|
patches = [
|
2024-06-05 15:53:02 +00:00
|
|
|
# Creates a @libbqn@ substitution variable, to be filled in postFixup
|
2021-10-04 12:37:57 +00:00
|
|
|
./001-libbqn-path.patch
|
|
|
|
];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
mkdir -p $out/bin $out/share/bqn
|
|
|
|
cp bqn.js $out/share/bqn/bqn.js
|
|
|
|
cp docs/bqn.js $out/share/bqn/libbqn.js
|
2021-10-04 12:37:57 +00:00
|
|
|
|
|
|
|
makeWrapper "${lib.getBin nodejs}/bin/node" "$out/bin/mbqn" \
|
2024-06-05 15:53:02 +00:00
|
|
|
--add-flags "$out/share/bqn/bqn.js"
|
2021-10-04 12:37:57 +00:00
|
|
|
|
|
|
|
ln -s $out/bin/mbqn $out/bin/bqn
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
postFixup = ''
|
|
|
|
substituteInPlace $out/share/bqn/bqn.js \
|
|
|
|
--subst-var-by "libbqn" "$out/share/bqn/libbqn.js"
|
|
|
|
'';
|
2021-10-04 12:37:57 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
dontConfigure = true;
|
2021-10-04 12:37:57 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
strictDeps = true;
|
2021-10-04 12:37:57 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
meta = {
|
2021-10-04 12:37:57 +00:00
|
|
|
homepage = "https://github.com/mlochbaum/BQN/";
|
|
|
|
description = "The original BQN implementation in Javascript";
|
2024-06-05 15:53:02 +00:00
|
|
|
license = lib.licenses.isc;
|
|
|
|
maintainers = with lib.maintainers; [ AndersonTorres ];
|
|
|
|
inherit (nodejs.meta) platforms;
|
2021-10-04 12:37:57 +00:00
|
|
|
};
|
2024-06-05 15:53:02 +00:00
|
|
|
})
|
2021-10-04 12:37:57 +00:00
|
|
|
# TODO: install docs and other stuff
|