Skip to content

Commit

Permalink
glow-lang: init at 2021-09-12
Browse files Browse the repository at this point in the history
Release v0.3.1
  • Loading branch information
fare committed Sep 12, 2021
1 parent 9bbcf47 commit fcd5b99
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkgs/development/compilers/gerbil/gerbil-support.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ selfPop (gerbil-support: with gerbil-support; {
prePackages-unstable =
let pks = [ ./gerbil-libp2p.nix ./smug-gerbil.nix ./ftw.nix
./gerbil-utils.nix ./gerbil-crypto.nix ./gerbil-poo.nix
./gerbil-persist.nix ./gerbil-ethereum.nix ];
./gerbil-persist.nix ./gerbil-ethereum.nix ./glow-lang.nix ];
call = pkg: callPackage pkg (unpop prePackage-defaults);
pkgName = pkg: lib.removeSuffix ".nix" (baseNameOf pkg);
f = pkg: { name = pkgName pkg; value = call pkg; }; in
Expand Down
55 changes: 55 additions & 0 deletions pkgs/development/compilers/gerbil/glow-lang.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{ lib, fetchFromGitLab, gerbil-support, gerbilPackages, gerbil, ... }:

rec {
pname = "glow-lang";
version = "unstable-2021-09-12";
git-version = "0.3.1";
softwareName = "Glow";
gerbil-package = "mukn/glow";
version-path = "version";

gerbilInputs = with gerbilPackages;
[ gerbil-utils gerbil-crypto gerbil-poo gerbil-persist gerbil-ethereum
gerbil-libp2p smug-gerbil ftw ];

pre-src = {
fun = fetchFromGitLab;
owner = "mukn";
repo = "glow";
rev = "b8062a3bcf27c9c87ae591a59d6734e76931f644";
sha256 = "0izq60hssw48qh5zbnhqq5b4v38dcc05sgls9p71510fix6qgpp8";
};

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 ];
};
}
3 changes: 2 additions & 1 deletion pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11007,7 +11007,8 @@ with pkgs;
gerbil = callPackage ../development/compilers/gerbil { };
gerbil-unstable = callPackage ../development/compilers/gerbil/unstable.nix { };
gerbil-support = callPackage ../development/compilers/gerbil/gerbil-support.nix { };
gerbilPackages-unstable = gerbil-support.gerbilPackages-unstable; # NB: don't recurseIntoAttrs for (unstable!) libraries
gerbilPackages-unstable = pkgs.gerbil-support.gerbilPackages-unstable; # NB: don't recurseIntoAttrs for (unstable!) libraries
glow-lang = pkgs.gerbilPackages-unstable.glow-lang;

inherit (let
num =
Expand Down

0 comments on commit fcd5b99

Please sign in to comment.