Add example of how to use the flake
For someone else I made an example flake to create a cabal dev shell that build dependencies:
{
description = "My Haskell project";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
wasm.url = "tarball+https://gitlab.haskell.org/ghc/ghc-wasm-meta/-/archive/master/ghc-wasm-meta-master.tar.gz";
};
outputs = { self, nixpkgs, flake-compat, wasm }:
let
pkgs = nixpkgs.legacyPackages.x86_64-linux;
in
{
inherit pkgs;
inherit wasm;
devShell.x86_64-linux = pkgs.mkShell
{
packages = [
(pkgs.writeShellScriptBin "ghc" "exec -a $0 ${wasm.packages.x86_64-linux.wasm32-wasi-ghc-9_6}/bin/wasm32-wasi-ghc $@")
(pkgs.writeShellScriptBin "ghc-pkg" "exec -a $0 ${wasm.packages.x86_64-linux.wasm32-wasi-ghc-9_6}/bin/wasm32-wasi-ghc-pkg $@")
wasm.packages.x86_64-linux.cabal
wasm.packages.x86_64-linux.wasm32-wasi-ghc-9_6
];
};
};
}
You may want to add this (or something similar), to your project as an example. It's not obvious at all.
Furthermore this paritucular setup also completely ignores the existing haskell infrastructure in nixpkgs (eg haskellPackages.shellFor
), it'd be nice if there was support for that as well.