Skip to content

Reproducible nix overlay of binary distributed MoonBit toolchains and LSP

Notifications You must be signed in to change notification settings

ghishadow/moonbit-overlay

 
 

Repository files navigation

moonbit-overlay

Binary distributed MoonBit toolchains.

NOTE: moonbit-compiler was already open sourced, BUT only wasm-gc backend is available. Considering this is an incomplete compiler and the version is quite lagging, this project will still only be able to use patched pre-built binaries for a long time.

Quick Start

Run moon in one line

nix run github:jetjinser/moonbit-overlay#moon

List all available binaries

nix run github:jetjinser/moonbit-overlay#<tab>

Create devshell from template

nix flake init -t github:jetjinser/moonbit-overlay

Features

  • build from source in future.
  • versioning!
  • patchelf works :)

Example

flake with overlay

{
  description = "A startup basic MoonBit project";

  inputs = {
    flake-parts.url = "github:hercules-ci/flake-parts";
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

    devshell.url = "github:numtide/devshell";
    moonbit-overlay.url = "github:jetjinser/moonbit-overlay";
  };

  outputs = inputs@{ flake-parts, ... }:
    flake-parts.lib.mkFlake { inherit inputs; } {
      imports = [
        inputs.devshell.flakeModule
      ];

      perSystem = { inputs', system, pkgs, ... }: {
        _module.args.pkgs = import inputs.nixpkgs {
          inherit system;
          overlays = [ inputs.moonbit-overlay.overlays.default ];
        };

        devshells.default = {
            packages = with pkgs; [
              moonbit-bin.moonbit.latest
              moonbit-bin.lsp.latest
            ];
          };
      };

      systems = [
        "x86_64-linux"
        "aarch64-darwin"
        "x86_64-darwin"
      ];
    };
}

Bundled MoonBit Toolchains

moonbit-bin.moonbit.latest

MoonBit LSP (extracted from moonbit-lang vscode extension)

moonbit-bin.lsp.latest

Version

latest

moonbit-bin.moonbit.latest

specific version

moonbit-bin.moonbit.v0_1_20241031-7204facb6

Check available versions in the directory.

The original version of MoonBit is written as v0.1.20241031+7204facb6, for convenience, we escape it to format like v0_1_20241031-7204facb6.

TODO

  • overridable
  • build from source (core)
  • re-support legacy default.nix

Inspiration

The moonbit-overlay is heavily inspired by rust-overlay.

About

Reproducible nix overlay of binary distributed MoonBit toolchains and LSP

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages

  • Nix 76.8%
  • Shell 23.2%