Introduction

xkcd 927

A simple yet another haskell.nix wrapper that doesn't promise much, doesn't force you to use flake.parts nor anything similar, simply will build a haskell package for you. You are responsible for creating flake attributes where you wish.

Repository

See usage instructions here.

Documentation

Setup

Add simple-haskell-nix to your flake inputs

{
  inputs = {
    simpleHaskellNix.url = "github:mlabs-haskell/simple-haskell-nix";
    # ...
  };
  # ...
}

With flake.parts

  1. Import module
{
  # ...
  outputs = inputs:
    inputs.flake-parts.lib.mkFlake { inherit inputs; } ({ self, ... }: {
      imports = [
        inputs.simpleHaskellNix.flakeModules.simpleHaskellNix
      ];
      # ...
    };
}
  1. Call mkPackage
{
  perSystem = { simpleHaskellNix, ... }:
    let
      example = simpleHaskellNix.mkPackage {
        name = "example";
        src = ./.;
      };
    in
    {
      devShells.example = example.devShell;
      packages = {
        example = example.packages."example:exe:example";
      };
    };
}

Plain flakes

Call mkPackage

{
  # ...
  outputs = {
    packages.x86_64-linux.example =
      let
        example = inputs.simpleHaskellNix.legacyPackages.x86_64-linux.mkPackage {
          name = "example";
          src = ./.;
        };
      in example.packages."example:exe:example";
  };
}

See all arguments below. Full example

mkPackage arguments

externalDependencies

Type: list of (path or package)

Default: [ ]

externalRepositories

Type: lazy attribute set of anything

Default: { }

ghcVersion

Haskell compiler to use

Type: string

Default: "ghc928"

haskellModules

Type: list of anything

Default: [ ]

name

Name of package

Type: string

src

Path to package root, i.e. a directory with .cabal file

Type: path