btrbk: add mainProgram (#356350)
[NixPkgs.git] / pkgs / development / compilers / gerbil / gerbil-ethereum.nix
blob42891aeca4d081d6d5afb511bd018e853124ddfd
1 { lib, fetchFromGitHub, gerbilPackages, gerbil-support, gerbil, ... }:
3 rec {
4   pname = "gerbil-ethereum";
5   version = "unstable-2023-12-04";
6   git-version = "0.2-11-g124ec58";
7   softwareName = "Gerbil-ethereum";
8   gerbil-package = "clan/ethereum";
9   version-path = "version";
11   gerbilInputs = with gerbilPackages; [
12     gerbil-utils gerbil-crypto gerbil-poo gerbil-persist gerbil-leveldb ];
14   pre-src = {
15     fun = fetchFromGitHub;
16     owner = "mighty-gerbils";
17     repo = "gerbil-ethereum";
18     rev = "124ec585157e2c505cd3c449a389c124ca6da9e9";
19     sha256 = "0xg07k421r5p0qx98id66k0k2l3vi1is875857sd8q3h6bks0z54";
20   };
22   postInstall = ''
23     cp scripts/{croesus.prv,genesis.json,logback.xml,yolo-evm.conf,yolo-kevm.conf,run-ethereum-test-net.ss} $out/gerbil/lib/clan/ethereum/scripts/
24     mkdir -p $out/bin
25     cat > $out/bin/run-ethereum-test-net <<EOF
26     #!/bin/sh
27     #|
28     ORIG_GERBIL_LOADPATH="\$GERBIL_LOADPATH"
29     ORIG_GERBIL_PATH="\$GERBIL_PATH"
30     ORIG_GERBIL_HOME="\$GERBIL_HOME"
31     unset GERBIL_HOME
32     GERBIL_LOADPATH="${gerbil-support.gerbilLoadPath (["$out"] ++ gerbilInputs)}"
33     GERBIL_PATH="\$HOME/.cache/gerbil-ethereum/gerbil"
34     export GERBIL_PATH GERBIL_LOADPATH GLOW_SOURCE ORIG_GERBIL_PATH ORIG_GERBIL_LOADPATH
35     exec ${gerbil}/bin/gxi "\$0" "\$@"
36     |#
37     (import :clan/ethereum/scripts/run-ethereum-test-net :std/lib/multicall)
38     (apply call-entry-point (cdr (command-line)))
39     EOF
40     chmod a+x $out/bin/run-ethereum-test-net
41     '';
43   meta = with lib; {
44     description = "Gerbil Ethereum: a Scheme alternative to web3.js";
45     homepage    = "https://github.com/fare/gerbil-ethereum";
46     license     = licenses.asl20;
47     platforms   = platforms.unix;
48     maintainers = with maintainers; [ fare ];
49   };