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"
];
};
}{
description = "A startup basic MoonBit project";
inputs = {
flake-parts.url = "github:hercules-ci/flake-parts";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
moonbit-overlay.url = "github:moonbit-community/moonbit-overlay";
moon-registry = {
url = "mooncakes.io/git/index";
flake = false;
};
};
outputs = inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
perSystem = { inputs', system, pkgs, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.moonbit-overlay.overlays.default ];
};
packages.default = pkgs.moonPlatform.buildMoonPackage {
name = "my-brilliant-moonbit-project";
src = ./.;
version = "0.1.0";
moonModJson = ./moon.mod.json;
moonRegistryIndex = inputs.moon-registry;
moonFlags = [ "--release" ];
}
};
systems = [
"x86_64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
};
}moonbit-bin.moonbit.latestThe moonbit-bin.moonbit.${version} package already includes moonbit-lsp.
moonbit-bin.moonbit.latestmoonbit-bin.moonbit.latestmoonbit-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.