push sheeet
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s

This commit is contained in:
Dark Steveneq
2025-10-09 14:15:47 +02:00
commit 646b892680
49168 changed files with 5897842 additions and 0 deletions

View File

@@ -0,0 +1,151 @@
{
lib,
callPackage,
fixDarwinDylibNames,
libffi,
mbqn-source,
pkg-config,
stdenv,
# Boolean flags
enableReplxx ? false,
enableLibcbqn ? ((stdenv.hostPlatform.isLinux || stdenv.hostPlatform.isDarwin) && !enableReplxx),
generateBytecode ? false,
# "Configurable" options
bqn-interpreter,
}:
let
sources = callPackage ./sources.nix { };
in
stdenv.mkDerivation {
pname = "cbqn" + lib.optionalString (!generateBytecode) "-standalone";
inherit (sources.cbqn) version src;
nativeBuildInputs = [
pkg-config
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
fixDarwinDylibNames
];
buildInputs = [
libffi
];
makeFlags = [
"CC=${stdenv.cc.targetPrefix}cc"
];
buildFlags = [
# interpreter binary
"o3"
"notui=1" # display build progress in a plain-text format
"REPLXX=${if enableReplxx then "1" else "0"}"
]
++ lib.optionals stdenv.hostPlatform.avx2Support [
"has=avx2"
]
++ lib.optionals enableLibcbqn [
# embeddable interpreter as a shared lib
"shared-o3"
];
outputs = [
"out"
]
++ lib.optionals enableLibcbqn [
"lib"
"dev"
];
dontConfigure = true;
doInstallCheck = true;
strictDeps = true;
postPatch = ''
sed -i '/SHELL =.*/ d' makefile
patchShebangs build/build
'';
preBuild = ''
mkdir -p build/singeliLocal/
cp -r ${sources.singeli.src}/* build/singeliLocal/
''
+ (
if generateBytecode then
''
mkdir -p build/bytecodeLocal/gen
${bqn-interpreter} ./build/genRuntime ${mbqn-source} build/bytecodeLocal/
''
else
''
mkdir -p build/bytecodeLocal/gen
cp -r ${sources.cbqn-bytecode.src}/* build/bytecodeLocal/
''
)
+ lib.optionalString enableReplxx ''
mkdir -p build/replxxLocal/
cp -r ${sources.replxx.src}/* build/replxxLocal/
'';
installPhase = ''
runHook preInstall
mkdir -p $out/bin/
cp BQN -t $out/bin/
# note guard condition for case-insensitive filesystems
[ -e $out/bin/bqn ] || ln -s $out/bin/BQN $out/bin/bqn
[ -e $out/bin/cbqn ] || ln -s $out/bin/BQN $out/bin/cbqn
''
+ lib.optionalString enableLibcbqn ''
install -Dm644 include/bqnffi.h -t "$dev/include"
install -Dm755 libcbqn${stdenv.hostPlatform.extensions.sharedLibrary} -t "$lib/lib"
''
+ ''
runHook postInstall
'';
installCheckPhase = ''
runHook preInstallCheck
# main test suite from mlochbaum/BQN
$out/bin/BQN ${mbqn-source}/test/this.bqn
# CBQN tests that do not require compiling with test-only flags
$out/bin/BQN test/cmp.bqn
$out/bin/BQN test/equal.bqn
$out/bin/BQN test/copy.bqn
$out/bin/BQN test/bit.bqn
$out/bin/BQN test/hash.bqn
$out/bin/BQN test/squeezeValid.bqn
$out/bin/BQN test/squeezeExact.bqn
$out/bin/BQN test/various.bqn
$out/bin/BQN test/random.bqn
runHook postInstallCheck
'';
meta = {
homepage = "https://github.com/dzaima/CBQN/";
description = "BQN implementation in C";
license = with lib.licenses; [
# https://github.com/dzaima/CBQN?tab=readme-ov-file#licensing
asl20
boost
gpl3Only
lgpl3Only
mit
mpl20
];
mainProgram = "cbqn";
maintainers = with lib.maintainers; [
detegr
shnarazk
sternenseemann
synthetica
];
platforms = lib.platforms.all;
};
}

View File

@@ -0,0 +1,61 @@
# Sources required to build CBQN
# Update them all at the same time, or else misbuilds will happen!
# TODO: automate the update of this file
{
fetchFromGitHub,
}:
{
cbqn =
let
self = {
pname = "cbqn";
version = "0.9.0";
src = fetchFromGitHub {
owner = "dzaima";
repo = "CBQN";
rev = "v${self.version}";
hash = "sha256-WGQvnNVnNkz0PR/E5L05KvaaRZ9hgt9gNdzsR9OFYxA=";
};
};
in
self;
cbqn-bytecode = {
pname = "cbqn-bytecode";
version = "0-unstable-2025-03-16";
src = fetchFromGitHub {
owner = "dzaima";
repo = "cbqnBytecode";
rev = "0bdfb86d438a970b983afbca93011ebd92152b88";
hash = "sha256-oUM4UwLy9tusTFLlaZbbHfFqKEcqd9Mh4tTqiyvMyvo=";
};
};
replxx = {
pname = "replxx";
version = "0-unstable-2023-10-31";
src = fetchFromGitHub {
owner = "dzaima";
repo = "replxx";
rev = "13f7b60f4f79c2f14f352a76d94860bad0fc7ce9";
hash = "sha256-xPuQ5YBDSqhZCwssbaN/FcTZlc3ampYl7nfl2bbsgBA=";
};
};
singeli = {
pname = "singeli";
version = "0-unstable-2025-03-13";
src = fetchFromGitHub {
owner = "mlochbaum";
repo = "Singeli";
rev = "53f42ce4331176d281fa577408ec5a652bdd9127";
hash = "sha256-NbCNd/m0SdX2/aabeOhAzEYc5CcT/r75NR5ScuYj77c=";
};
};
}