diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1794231..804be02 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -32,6 +32,9 @@ jobs: - name: Clean and GC run: nix develop .#wasm --command bash -c "make" && nix-collect-garbage -d + - name: Build MicroHs using Nix + run: nix develop .#mhs --command bash -c "make mhs" + - name: Build JS using Nix run: nix develop .#ghcjs --command bash -c "make js" diff --git a/.gitignore b/.gitignore index 5f09a61..a78fdf2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ dist* result public +.mcabal +.emcache diff --git a/Makefile b/Makefile index e5deb8d..641be2d 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ all: update build optim js: update-js build-js +mhs: build-mhs + update: wasm32-wasi-cabal update @@ -33,18 +35,24 @@ serve: http-server public clean: - rm -rf dist-newstyle public + rm -rf dist-newstyle dist-mcabal public update-js: cabal update --with-ghc=javascript-unknown-ghcjs-ghc --with-hc-pkg=javascript-unknown-ghcjs-ghc-pkg build-js: cabal build --with-ghc=javascript-unknown-ghcjs-ghc --with-hc-pkg=javascript-unknown-ghcjs-ghc-pkg - cp -v ./dist-newstyle/build/javascript-ghcjs/ghc-9.12.2/*/x/app/build/app/app.jsexe/all.js . + cp -v ./dist-newstyle/build/javascript-ghcjs/ghc-*/*/x/app/build/app/app.jsexe/all.js . rm -rf public cp -rv static public bunx --bun swc ./all.js -o public/index.js +build-mhs: + mcabal --options=-tbrowser build + rm -rf public + cp -rv static public + cp -v ./dist-mcabal/bin/mhs/app public/index.js + ghcup-update: cabal update $(CABAL_ARGS) diff --git a/README.md b/README.md index 7268813..0905457 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,12 @@ $ nix develop .#wasm --command bash -c "make" $ nix develop .#ghcjs --command bash -c "make js" ``` +### Build (MicroHs) + +```bash +$ nix develop .#mhs --command bash -c "make mhs" +``` + ### Serve To host the built application you can call `serve` diff --git a/cabal.project b/cabal.project index 8cfd906..01a7026 100644 --- a/cabal.project +++ b/cabal.project @@ -4,6 +4,9 @@ packages: allow-newer: all:base +constraints: + aeson >= 2 + source-repository-package type: git location: https://github.com/dmjio/miso diff --git a/flake.lock b/flake.lock index f13d9fa..ccf48c6 100644 --- a/flake.lock +++ b/flake.lock @@ -43,11 +43,11 @@ }, "locked": { "host": "gitlab.haskell.org", - "lastModified": 1775305067, - "narHash": "sha256-KFWRYVYPgsXu51stX/7/416qc31HFltfQiHPc6nEmH0=", + "lastModified": 1789039765, + "narHash": "sha256-XzoDVK/1hsI+VUf5tPyhhzfZKfXTzm4hCrrHwCLz9AI=", "owner": "haskell-wasm", "repo": "ghc-wasm-meta", - "rev": "60098a5076557e327b326a1a3ba3b5fb4fec1e49", + "rev": "358ea50b8496a69da6ce375c0c58bc049dbcb92d", "type": "gitlab" }, "original": { @@ -64,11 +64,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1778664899, - "narHash": "sha256-N0wIPYEoqCKZqyAqNxQ87sjpijZZNAx+/sx2/Feot08=", + "lastModified": 1790876521, + "narHash": "sha256-PSREqoUN7Tnpi50Kgnv9xN8Yk5Pd2aNkMnz65u7LzZE=", "owner": "dmjio", "repo": "miso", - "rev": "efae40b82c1452891f78e79c139d6421983878a6", + "rev": "4ebc461f6379932cc95fc56b85a4cf5ff2288fde", "type": "github" }, "original": { @@ -79,33 +79,33 @@ }, "nixpkgs": { "locked": { - "lastModified": 1774399958, - "narHash": "sha256-Q+g1Np4wyNYpylt8RFM8UprAmyRoA3q3EZj7lQV+ZuQ=", + "lastModified": 1789009968, + "narHash": "sha256-GB16oaxpsrnGNnGIE+0uYBqMRzB9X6FYDUvjvnJAYew=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "735a15e91bcb1b3e0883a91d3c9dfd4475d1bc54", + "rev": "d58a46e3bc02d91ebe04667f8397752a749c0024", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixpkgs-25.11-darwin", + "ref": "nixpkgs-26.05-darwin", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { "locked": { - "lastModified": 1751996040, - "narHash": "sha256-DOjNE+DYZ/YZo1UkXcJNlvSKEBowWATX6o4s0WuAzuA=", + "lastModified": 1788881743, + "narHash": "sha256-2V9GZGvPfrNzxFozhI9dcqV+c3QdA8YZrvAAzqEB+dI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9e2e8a7878573d312db421d69e071690ec34e98c", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", "type": "github" }, "original": { "owner": "nixos", "repo": "nixpkgs", - "rev": "9e2e8a7878573d312db421d69e071690ec34e98c", + "rev": "d6524aaca2ff07876657ae2b323f24be4874944b", "type": "github" } }, diff --git a/flake.nix b/flake.nix index c0d06d9..0fcb5ff 100644 --- a/flake.nix +++ b/flake.nix @@ -10,6 +10,7 @@ devShells.hls = inputs.miso.outputs.devShells.${system}.hls; devShells.wasm = inputs.miso.outputs.devShells.${system}.wasm; devShells.ghcjs = inputs.miso.outputs.devShells.${system}.ghcjs; + devShells.mhs = inputs.miso.outputs.devShells.${system}.mhs; }); }