{ description = "Gleam compiler (wasm / Zed extension support fork)"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; systems.url = "github:nix-systems/default"; fenix.url = "github:nix-community/fenix"; fenix.inputs.nixpkgs.follows = "nixpkgs"; }; outputs = { self, nixpkgs, systems, fenix, ... }: let forEachSystem = nixpkgs.lib.genAttrs (import systems); in { packages = forEachSystem ( system: let pkgs = nixpkgs.legacyPackages.${system}; inherit (pkgs) lib; # Recent stable for edition 2024 workspace. rustToolchain = fenix.packages.${system}.stable.toolchain or fenix.packages.${system}.complete.toolchain; rustPlatform = pkgs.makeRustPlatform { cargo = rustToolchain; rustc = rustToolchain; }; gleam = rustPlatform.buildRustPackage { pname = "gleam"; version = "1.18.0-rc2"; src = lib.cleanSourceWith { src = ./.; filter = path: type: let base = baseNameOf path; in lib.cleanSourceFilter path type && base != "target" && base != "result" && !(lib.hasSuffix ".wasm" base) && !(lib.hasSuffix ".cwasm" base); }; cargoLock = { lockFile = ./Cargo.lock; }; nativeBuildInputs = [ pkgs.capnproto pkgs.pkg-config ]; # Workspace: only build/install the CLI crate. buildAndTestSubdir = "gleam-bin"; # Full test suite is heavy and needs network / many backends. doCheck = false; meta = { description = "Gleam compiler with Wasm / Zed extension export"; mainProgram = "gleam"; homepage = "https://tangled.org/nandi.uk/gleam"; license = lib.licenses.asl20; }; }; in { default = gleam; inherit gleam; } ); apps = forEachSystem (system: { default = { type = "app"; program = "${self.packages.${system}.gleam}/bin/gleam"; }; }); devShells = forEachSystem ( system: let pkgs = nixpkgs.legacyPackages.${system}; rustToolchain = fenix.packages.${system}.stable.toolchain or fenix.packages.${system}.complete.toolchain; in { default = pkgs.mkShell { packages = [ rustToolchain pkgs.capnproto pkgs.pkg-config self.packages.${system}.gleam ]; shellHook = '' echo "gleam wasm fork dev shell" echo " gleam --version # store build when packages.gleam is built" echo " cargo build -p gleam" ''; }; } ); checks = forEachSystem (system: { package = self.packages.${system}.gleam; }); formatter = forEachSystem (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style); }; }