diff --git a/.gitignore b/.gitignore index f2fc71b..04eb3c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ dist-newstyle .direnv -*.cabal \ No newline at end of file +*.cabal diff --git a/flake.lock b/flake.lock index c6c4490..63fe929 100644 --- a/flake.lock +++ b/flake.lock @@ -16,7 +16,62 @@ "type": "github" } }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "ghc-wasm-meta": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "host": "gitlab.haskell.org", + "lastModified": 1775305067, + "narHash": "sha256-KFWRYVYPgsXu51stX/7/416qc31HFltfQiHPc6nEmH0=", + "owner": "haskell-wasm", + "repo": "ghc-wasm-meta", + "rev": "60098a5076557e327b326a1a3ba3b5fb4fec1e49", + "type": "gitlab" + }, + "original": { + "host": "gitlab.haskell.org", + "owner": "haskell-wasm", + "repo": "ghc-wasm-meta", + "type": "gitlab" + } + }, "nixpkgs": { + "locked": { + "lastModified": 1774399958, + "narHash": "sha256-Q+g1Np4wyNYpylt8RFM8UprAmyRoA3q3EZj7lQV+ZuQ=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "735a15e91bcb1b3e0883a91d3c9dfd4475d1bc54", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-25.11-darwin", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1777268161, "narHash": "sha256-bxrdOn8SCOv8tN4JbTF/TXq7kjo9ag4M+C8yzzIRYbE=", @@ -35,7 +90,23 @@ "root": { "inputs": { "flake-compat": "flake-compat", - "nixpkgs": "nixpkgs" + "ghc-wasm-meta": "ghc-wasm-meta", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index afba6cb..425f2d0 100644 --- a/flake.nix +++ b/flake.nix @@ -3,6 +3,8 @@ inputs = { nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable"; + ghc-wasm-meta.url = "gitlab:haskell-wasm/ghc-wasm-meta?host=gitlab.haskell.org"; + flake-compat = { url = "github:NixOS/flake-compat"; flake = false; @@ -10,11 +12,20 @@ }; outputs = - { self, nixpkgs, ... }: + { + self, + nixpkgs, + ghc-wasm-meta, + ... + }: let pkgs = nixpkgs.legacyPackages.x86_64-linux; in { - devShells.x86_64-linux.default = pkgs.callPackage ./shell.nix { }; + inherit ghc-wasm-meta; + devShells.x86_64-linux.default = pkgs.callPackage ./shell.nix { + wasm32-wasi-cabal = ghc-wasm-meta.packages.x86_64-linux.wasm32-wasi-cabal-9_14; + wasm32-wasi-ghc = ghc-wasm-meta.packages.x86_64-linux.wasm32-wasi-ghc-9_14; + }; }; } diff --git a/numbersquare.cabal b/numbersquare.cabal index 799db3b..594931d 100644 --- a/numbersquare.cabal +++ b/numbersquare.cabal @@ -100,7 +100,7 @@ test-suite numberspec-test OverloadedLabels NamedFieldPuns TypeOperators - ghc-options: -Wall -threaded -O0 + ghc-options: -Wall -O0 build-depends: QuickCheck , array diff --git a/package.yaml b/package.yaml index 05e7b0d..4dbaee7 100644 --- a/package.yaml +++ b/package.yaml @@ -31,6 +31,8 @@ default-extensions: - NamedFieldPuns - TypeOperators +build-type: Simple + library: source-dirs: - src @@ -43,7 +45,7 @@ executable: tests: numberspec-test: main: "Main.hs" - ghc-options: "-threaded -O0" + ghc-options: "-O0" source-dirs: - test diff --git a/shell.nix b/shell.nix index 00a07b7..7f913a0 100644 --- a/shell.nix +++ b/shell.nix @@ -3,6 +3,8 @@ haskell, zlib, watchexec, + wasm32-wasi-cabal, + wasm32-wasi-ghc, }: haskellPackages.developPackage { name = "numbersquare"; @@ -12,7 +14,11 @@ haskellPackages.developPackage { addBuildTools = drv: haskell.lib.addBuildTools drv ( - [ watchexec ] + [ + watchexec + wasm32-wasi-cabal + wasm32-wasi-ghc + ] ++ (with haskellPackages; [ fourmolu haskell-language-server