b5f92a349c
GitOrigin-RevId: 7c9cc5a6e5d38010801741ac830a3f8fd667a7a0
56 lines
1.8 KiB
Nix
56 lines
1.8 KiB
Nix
{ lib, fetchFromGitHub, gerbil-support, gerbilPackages, gerbil, ... }:
|
|
|
|
rec {
|
|
pname = "glow-lang";
|
|
version = "unstable-2023-10-06";
|
|
git-version = "0.3.2-232-ga1a7a9e5";
|
|
softwareName = "Glow";
|
|
gerbil-package = "mukn/glow";
|
|
version-path = "version";
|
|
|
|
gerbilInputs = with gerbilPackages;
|
|
[ gerbil-utils gerbil-crypto gerbil-poo gerbil-persist gerbil-ethereum
|
|
smug-gerbil gerbil-leveldb # gerbil-libp2p ftw
|
|
];
|
|
|
|
pre-src = {
|
|
fun = fetchFromGitHub;
|
|
owner = "Glow-Lang";
|
|
repo = "glow";
|
|
rev = "a1a7a9e51ba9a466d91c397d9da55af90076110c";
|
|
sha256 = "0wgav4gbg6mlxgisjjbyhvhz94b29vv2rkjkjy1jl7v0hs3wbm52";
|
|
};
|
|
|
|
postPatch = ''
|
|
substituteInPlace "runtime/glow-path.ss" --replace \
|
|
'(def glow-install-path (source-path "dapps"))' \
|
|
'(def glow-install-path "$out")'
|
|
'';
|
|
|
|
postInstall = ''
|
|
mkdir -p $out/bin $out/gerbil/lib/mukn/glow $out/share/glow/dapps
|
|
cp main.ss $out/gerbil/lib/mukn/glow/
|
|
cp dapps/{buy_sig,coin_flip,rps_simple}.glow $out/share/glow/dapps/
|
|
cat > $out/bin/glow <<EOF
|
|
#!/bin/sh
|
|
ORIG_GERBIL_LOADPATH="\$GERBIL_LOADPATH"
|
|
ORIG_GERBIL_PATH="\$GERBIL_PATH"
|
|
ORIG_GERBIL_HOME="\$GERBIL_HOME"
|
|
unset GERBIL_HOME
|
|
GERBIL_LOADPATH="${gerbil-support.gerbilLoadPath (["$out"] ++ gerbilInputs)}"
|
|
GLOW_SOURCE="\''${GLOW_SOURCE:-$out/share/glow}"
|
|
GERBIL_PATH="\$HOME/.cache/glow/gerbil"
|
|
export GERBIL_PATH GERBIL_LOADPATH GLOW_SOURCE ORIG_GERBIL_PATH ORIG_GERBIL_LOADPATH ORIG_GERBIL_HOME
|
|
exec ${gerbil}/bin/gxi $out/gerbil/lib/mukn/glow/main.ss "\$@"
|
|
EOF
|
|
chmod a+x $out/bin/glow
|
|
'';
|
|
|
|
meta = with lib; {
|
|
description = "Glow: language for safe Decentralized Applications (DApps)";
|
|
homepage = "https://glow-lang.org";
|
|
license = licenses.asl20;
|
|
platforms = platforms.unix;
|
|
maintainers = with maintainers; [ fare ];
|
|
};
|
|
}
|