2023-05-18 01:31:06 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromSourcehut
|
|
|
|
, gitUpdater
|
|
|
|
, hare
|
2023-05-18 07:34:41 +00:00
|
|
|
, hare-ev
|
|
|
|
, hare-json
|
2023-05-18 01:31:06 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "bonsai";
|
2023-11-26 01:21:02 +00:00
|
|
|
version = "1.0.2";
|
2023-05-18 01:31:06 +00:00
|
|
|
|
|
|
|
src = fetchFromSourcehut {
|
|
|
|
owner = "~stacyharper";
|
2023-11-27 01:47:20 +00:00
|
|
|
repo = "bonsai";
|
2023-05-18 01:31:06 +00:00
|
|
|
rev = "v${version}";
|
2023-11-26 01:21:02 +00:00
|
|
|
hash = "sha256-Yosf07KUOQv4O5111tLGgI270g0KVGwzdTPtPOsTcP8=";
|
2023-05-18 01:31:06 +00:00
|
|
|
};
|
|
|
|
|
2023-08-10 07:41:12 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile \
|
|
|
|
--replace 'hare build' 'hare build $(HARE_TARGET_FLAGS)'
|
|
|
|
'';
|
|
|
|
|
|
|
|
env.HARE_TARGET_FLAGS =
|
|
|
|
if stdenv.hostPlatform.isAarch64 then
|
2023-11-26 01:21:02 +00:00
|
|
|
"-a aarch64"
|
2023-08-10 07:41:12 +00:00
|
|
|
else if stdenv.hostPlatform.isRiscV64 then
|
2023-11-26 01:21:02 +00:00
|
|
|
"-a riscv64"
|
2023-08-10 07:41:12 +00:00
|
|
|
else if stdenv.hostPlatform.isx86_64 then
|
2023-11-26 01:21:02 +00:00
|
|
|
"-a x86_64"
|
2023-08-10 07:41:12 +00:00
|
|
|
else
|
|
|
|
"";
|
2023-11-27 01:47:45 +00:00
|
|
|
# TODO: hare setup-hook is supposed to do this for us.
|
|
|
|
# It does it correctly for native compilation, but not cross compilation: wrong offset?
|
|
|
|
env.HAREPATH = "${hare-json}/src/hare/third-party:${hare-ev}/src/hare/third-party";
|
2023-08-10 07:41:12 +00:00
|
|
|
|
2023-05-18 01:31:06 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
hare
|
2023-11-27 01:47:20 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
2023-05-18 07:34:41 +00:00
|
|
|
hare-ev
|
|
|
|
hare-json
|
2023-05-18 01:31:06 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export HARECACHE=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
2023-08-10 07:41:12 +00:00
|
|
|
installFlags = [ "PREFIX=$(out)" ];
|
2023-05-18 01:31:06 +00:00
|
|
|
|
2023-11-27 01:47:20 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
2023-11-26 01:21:02 +00:00
|
|
|
passthru.updateScript = gitUpdater {
|
|
|
|
rev-prefix = "v";
|
|
|
|
};
|
2023-05-18 01:31:06 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
2023-11-27 01:47:20 +00:00
|
|
|
description = "Finite State Machine structured as a tree";
|
2023-05-18 01:31:06 +00:00
|
|
|
homepage = "https://git.sr.ht/~stacyharper/bonsai";
|
|
|
|
license = licenses.agpl3;
|
|
|
|
maintainers = with maintainers; [ colinsane ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|