nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 gerbil-support,
5 gerbilPackages,
6 gerbil,
7 ...
8}:
9
10rec {
11 pname = "glow-lang";
12 version = "unstable-2023-12-04";
13 git-version = "0.3.2-237-g08d849ad";
14 softwareName = "Glow";
15 gerbil-package = "mukn/glow";
16 version-path = "version";
17
18 gerbilInputs = with gerbilPackages; [
19 gerbil-utils
20 gerbil-crypto
21 gerbil-poo
22 gerbil-persist
23 gerbil-ethereum
24 smug-gerbil
25 gerbil-leveldb # gerbil-libp2p ftw
26 ];
27
28 pre-src = {
29 fun = fetchFromGitHub;
30 owner = "Glow-Lang";
31 repo = "glow";
32 rev = "08d849adef94ae9deead34e6981e77d47806c6e3";
33 sha256 = "0dq0s8y3rgx0wa5wsgcdjs0zijnbgff3y4w2mkh5a04gz4lrhl50";
34 };
35
36 postPatch = ''
37 substituteInPlace "runtime/glow-path.ss" --replace \
38 '(def glow-install-path (source-path "dapps"))' \
39 '(def glow-install-path "$out")'
40 '';
41
42 postInstall = ''
43 mkdir -p $out/bin $out/gerbil/lib/mukn/glow $out/share/glow/dapps
44 cp main.ss $out/gerbil/lib/mukn/glow/
45 cp dapps/{buy_sig,coin_flip,rps_simple}.glow $out/share/glow/dapps/
46 cat > $out/bin/glow <<EOF
47 #!/bin/sh
48 ORIG_GERBIL_LOADPATH="\$GERBIL_LOADPATH"
49 ORIG_GERBIL_PATH="\$GERBIL_PATH"
50 ORIG_GERBIL_HOME="\$GERBIL_HOME"
51 unset GERBIL_HOME
52 GERBIL_LOADPATH="${gerbil-support.gerbilLoadPath ([ "$out" ] ++ gerbilInputs)}"
53 GLOW_SOURCE="\''${GLOW_SOURCE:-$out/share/glow}"
54 GERBIL_PATH="\$HOME/.cache/glow/gerbil"
55 export GERBIL_PATH GERBIL_LOADPATH GLOW_SOURCE ORIG_GERBIL_PATH ORIG_GERBIL_LOADPATH ORIG_GERBIL_HOME
56 exec ${gerbil}/bin/gxi $out/gerbil/lib/mukn/glow/main.ss "\$@"
57 EOF
58 chmod a+x $out/bin/glow
59 '';
60
61 meta = {
62 description = "Glow: language for safe Decentralized Applications (DApps)";
63 homepage = "https://glow-lang.org";
64 license = lib.licenses.asl20;
65 platforms = lib.platforms.unix;
66 maintainers = with lib.maintainers; [ fare ];
67 broken = true; # Broken for all platforms since 2023-10-13
68 };
69}