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.
Run moon in one line
nix run github:moonbit-community/moonbit-overlay#moonnix run github:moonbit-community/moonbit-overlay#<tab>nix flake init -t github:moonbit-community/moonbit-overlay- build from source in future.
- versioning!
- patchelf works :)
{
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:moonbit-community/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
];
};
};
systems = [
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
};
}MoonBit project builds and Mooncakes dependency packaging are handled by moon-nix. This repository only distributes MoonBit toolchains.
moonbit-bin.moonbit.latestThe moonbit-bin.moonbit.${version} package already includes the language
server. Invoke it through moon lsp; current toolchains dispatch that command
to the bundled moon-lsp executable.
moonbit-bin.moonbit.latestLike the official installer, the toolchain also ships moonx as a symlink to
moon. The moon binary selects the moonx CLI when it is invoked under the
name moonx, so moonx runs packages from the Mooncakes registry without
installing them:
nix run github:moonbit-community/moonbit-overlay#moonx -- user/module/package
nix run github:moonbit-community/moonbit-overlay#moonx -- kokic/fakefetch/cli/ffetchmoonbit-bin.moonbit.latestmoonbit-bin.moonbit.nightlynightly is a rolling channel that tracks the upstream nightly build
(the same one the official installer fetches with install.sh nightly).
moonbit-bin.moonbit.v0_1_20241031-7204facb6Check available versions in the directory.
The original version of MoonBit is written as
v0.1.20241031+7204facb6, for convenience, we escape it to format likev0_1_20241031-7204facb6.
The overlay now provides both legacyPackages and packages attributes:
- legacyPackages: This is the original, structured attribute set. Packages are grouped by type (e.g.,
moonbit,cli,core) and version, making it easier to navigate the package hierarchy. - packages: This is a flattened attribute set, where each package is exposed as a single attribute (e.g.,
moonbit_latest,cli_v0_1_20241031-7204facb6). This structure is required fornix flake checkto work correctly, as it expects all packages to be directly accessible under thepackagesattribute.
Both are provided to maintain compatibility and usability: use legacyPackages for structured access, and packages for flake checks and direct access.
Some deprecated packages are still exposed for compatibility; attempting to use them will show a warning and prevent building.
- overridable
- build from source (core) see pull#10
- re-support legacy default.nix
The moonbit-overlay is heavily inspired by rust-overlay.
This project is licensed under the MIT License. See the LICENSE file for details.