I’m completely new to nix, and I’m trying to set up haskell-flake in order to use ghc-wasm. But I’m clueless on how to set it up correctly.
Currently, my flake file is (almost) the default one (end of post). And what’s currently puzzling me is that I can’t seem to find a schema which points out what am I supposed to define in the attribute set of haskellProjects.default
, where to put the compiler version I want (which I think is pkgs.haskell.compiler.ghc96
?) or how to import ghc-wasm (if I add it to the imports list as inputs.ghc-wasm-meta.flakeModule
it yields an error: attribute 'flakeModule' missing
error).
I’ll really appreciate any answer regarding on how to get this project going or even offering me a guide on how to get good c: (I can’t seem to find resources that are similar to the project I have, and reading flakes of similar projects often times sends me in a google spiral )
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
haskell-flake.url = "github:srid/haskell-flake";
ghc-wasm-meta.url = "git+https://gitlab.haskell.org/ghc/ghc-wasm-meta"; #"https://gitlab.haskell.org/ghc/ghc-wasm-meta/-/archive/master/ghc-wasm-meta-master.tar.gz";
};
outputs = inputs@{ self, nixpkgs, flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = nixpkgs.lib.systems.flakeExposed;
imports = [ inputs.haskell-flake.flakeModule inputs.ghc-wasm-meta.flakeModule];
perSystem = { self', pkgs, ... }: {
# Typically, you just want a single project named "default". But
# multiple projects are also possible, each using different GHC version.
haskellProjects.default = {
# The base package set representing a specific GHC version.
# By default, this is pkgs.haskellPackages.
# You may also create your own. See https://community.flake.parts/haskell-flake/package-set
basePackages = pkgs.haskellPackages;
# Extra package information. See https://community.flake.parts/haskell-flake/dependency
#
# Note that local packages are automatically included in `packages`
# (defined by `defaults.packages` option).
#
# packages = {
# aeson.source = "1.5.0.0"; # Hackage version override
# shower.source = inputs.shower;
# };
# settings = {
# aeson = {
# check = false;
# };
# relude = {
# haddock = false;
# broken = false;
# };
# };
# devShell = {
# # Enabled by default
# enable = true;
#
# # Programs you want to make available in the shell.
# # Default programs can be disabled by setting to 'null'
# tools = hp: { fourmolu = hp.fourmolu; ghcid = null; };
#
# hlsCheck.enable = true;
# };
};
# haskell-flake doesn't set the default package, but you can do it here.
packages.default = self'.packages.wasm;
};
};
}