A flake-parts Nix module for Haskell development
Go to file
github-actions[bot] f7cbb6c142 chore(doc): Update flake.lock
Flake lock file updates:

• Updated input 'cfp':
    'github:flake-parts/community.flake.parts/4e046a4fe52d09819d6698df39e5089cc4c65c6e?narHash=sha256-oomu5equUoWYQJuuxeUebhe9ekAGAMmBew3CQEolAQs%3D' (2024-06-15)
  → 'github:flake-parts/community.flake.parts/d4096a735618337db3d2869de83849cc7bb9989b?narHash=sha256-6FSuhdg6wRBEXhV4PSaXvgeG5XRgcygy4HhrDn0tlM4%3D' (2024-06-22)
• Updated input 'cfp/haskell-flake':
    'github:srid/haskell-flake/8bffb2266b38fe7983d14fc4858aea2e64ad2175?narHash=sha256-h9cBnB1hfF73g/K7FJtsOdcE0mbi00qBGCJ%2BCFH7jRQ%3D' (2024-06-09)
  → 'github:srid/haskell-flake/3f76199d42d55e3a36bf8e8e0544e715d6a3f007?narHash=sha256-6CToXT/jcbYBi3EMAZZtyPj14NsMbdAwq%2BZeQtfu5P0%3D' (2024-06-20)
• Updated input 'cfp/mission-control':
    'github:Platonic-Systems/mission-control/beb45a1d7fbd9c56233763ba568a09f1c5a9262d?narHash=sha256-gqp9YGqg5cc5fGmc%2BqM7YGEg8UANGJbwj%2BnnGk5K1/o%3D' (2024-04-16)
  → 'github:Platonic-Systems/mission-control/db5e2cc39c6799b301412d69182b9221c65146a8?narHash=sha256-hzLbxU580EaxKmkbQkiaMF3NoIzrcmVryGul5WSQatA%3D' (2024-06-19)
• Updated input 'cfp/nixos-flake':
    'github:srid/nixos-flake/c23ce31c707c3e4b699312ab9c80a4a003e893b1?narHash=sha256-Bom7owfn/piwRum%2BVmsRSGAjvnlhDEeE60IONzIQffs%3D' (2024-06-11)
  → 'github:srid/nixos-flake/6335b2f05f007b95ac2438b0a55498f9f20e73f7?narHash=sha256-A3JUcPH00buqBgjmi0lWUZIql9%2B8Y7CMSXGoUXcm%2Byk%3D' (2024-06-22)
• Updated input 'cfp/services-flake':
    'github:juspay/services-flake/107e8f43fb0453105d161e80fbc485d7b19eb401?narHash=sha256-RpMH7512W%2BvI4/h%2B/TO%2BjEu0gXZ9mhdoLdu4pi8mtxs%3D' (2024-06-15)
  → 'github:juspay/services-flake/c371cd53829e973a7dd0d065d183c68b26203c27?narHash=sha256-BHiV/z8pufVLi7ibDXbkYWBQh%2BP2fKyutp%2Bch8%2BiRPc%3D' (2024-06-21)
• Updated input 'flake-parts-website':
    'github:hercules-ci/flake.parts-website/a685938f82639afd3ebc340eb786ea53c4587cea?narHash=sha256-G1DGDwXKBo/TNUGuWIXuwC5mw7lkJ6GfWc%2BtFRfaUUg%3D' (2024-06-15)
  → 'github:hercules-ci/flake.parts-website/21e34b7855974026e33f1f4833d19ec3867f8f8c?narHash=sha256-va%2B220WFHXVioP1fwP08AdeP0b/raVcAIcKbtDuGXP4%3D' (2024-06-22)
• Updated input 'flake-parts-website/mission-control':
    'github:Platonic-Systems/mission-control/beb45a1d7fbd9c56233763ba568a09f1c5a9262d?narHash=sha256-gqp9YGqg5cc5fGmc%2BqM7YGEg8UANGJbwj%2BnnGk5K1/o%3D' (2024-04-16)
  → 'github:Platonic-Systems/mission-control/db5e2cc39c6799b301412d69182b9221c65146a8?narHash=sha256-hzLbxU580EaxKmkbQkiaMF3NoIzrcmVryGul5WSQatA%3D' (2024-06-19)
• Updated input 'flake-parts-website/nix-cargo-integration':
    'github:yusdacra/nix-cargo-integration/d216df369341dfd0aa18380a2a610466f05a0b3d?narHash=sha256-DLx43OzkHitAjTVVWOyBx13CuEH50EAIaSdxbHhnb88%3D' (2024-06-15)
  → 'github:yusdacra/nix-cargo-integration/1b6813a0b86878118f92291cff2e314945e4e8f7?narHash=sha256-lMITB8KabGyvcqs5wVfEsnZ/xJjuMG0mZ5bFeIpct/c%3D' (2024-06-22)
• Updated input 'flake-parts-website/nix-cargo-integration/rust-overlay':
    'github:oxalica/rust-overlay/7c2d603cb67c974ef8c5cfee1150060dbb299e04?narHash=sha256-s8QrTANEtY6UxzfkcBfoN93bgW9aCRIq54LPRVNu/4c%3D' (2024-06-15)
  → 'github:oxalica/rust-overlay/ff019b65a656d36dca3e57b43c40c44eec7852c5?narHash=sha256-ZDS8x9XpFeSBs9gMTHoujKWPn%2Bi9ecqE9NWEUF07Yuc%3D' (2024-06-22)
• Updated input 'flake-parts-website/nix-cargo-integration/treefmt':
    'github:numtide/treefmt-nix/e75ba0a6bb562d2ce275db28f6a36a2e4fd81391?narHash=sha256-35hUMmFesmchb%2Bu7heKHLG5B6c8fBOcSYo0jj0CHLes%3D' (2024-06-13)
  → 'github:numtide/treefmt-nix/68eb1dc333ce82d0ab0c0357363ea17c31ea1f81?narHash=sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls%3D' (2024-06-16)
• Updated input 'flake-parts-website/pre-commit-hooks-nix':
    'github:cachix/pre-commit-hooks.nix/cc4d466cb1254af050ff7bdf47f6d404a7c646d1?narHash=sha256-7XfBuLULizXjXfBYy/VV%2BSpYMHreNRHk9nKMsm1bgb4%3D' (2024-06-06)
  → 'github:cachix/pre-commit-hooks.nix/8cd35b9496d21a6c55164d8547d9d5280162b07a?narHash=sha256-RTyqP4fBX2MdhNuMP%2BfnR3lIwbdtXhyj7w7fwtvgspc%3D' (2024-06-20)
• Updated input 'flake-parts-website/pre-commit-hooks-nix/nixpkgs-stable':
    'github:NixOS/nixpkgs/614b4613980a522ba49f0d194531beddbb7220d3?narHash=sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84%3D' (2024-03-17)
  → 'github:NixOS/nixpkgs/842253bf992c3a7157b67600c2857193f126563a?narHash=sha256-JHuXsrC9pr4kA4n7LuuPfWFJUVlDBVJ1TXDVpHEuUgM%3D' (2024-06-15)
• Updated input 'flake-parts-website/process-compose-flake':
    'github:hercules-ci/process-compose-flake/2bd5ac6649dc124c7a51fcf3db97c43cb7683ed4?narHash=sha256-pcPALqEFSlAz%2B68SStQPoy9eT13dJ%2BtOe4OJbJCGToQ%3D' (2022-12-22)
  → 'github:Platonic-systems/process-compose-flake/9344fac44edced4c686721686a6ad904d067c546?narHash=sha256-%2BRrlkAVZx0QhyeHAGFJnjST%2B/7Dc3zsDU3zAKXoDXaI%3D' (2024-06-10)
• Updated input 'flake-parts-website/treefmt-nix':
    'github:numtide/treefmt-nix/e75ba0a6bb562d2ce275db28f6a36a2e4fd81391?narHash=sha256-35hUMmFesmchb%2Bu7heKHLG5B6c8fBOcSYo0jj0CHLes%3D' (2024-06-13)
  → 'github:numtide/treefmt-nix/68eb1dc333ce82d0ab0c0357363ea17c31ea1f81?narHash=sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls%3D' (2024-06-16)
• Updated input 'haskell-flake':
    'github:srid/haskell-flake/8bffb2266b38fe7983d14fc4858aea2e64ad2175?narHash=sha256-h9cBnB1hfF73g/K7FJtsOdcE0mbi00qBGCJ%2BCFH7jRQ%3D' (2024-06-09)
  → 'github:srid/haskell-flake/3f76199d42d55e3a36bf8e8e0544e715d6a3f007?narHash=sha256-6CToXT/jcbYBi3EMAZZtyPj14NsMbdAwq%2BZeQtfu5P0%3D' (2024-06-20)
2024-06-24 10:22:17 -04:00
.github/workflows chore(ci): Add workflow_dispatch 2024-06-24 10:21:27 -04:00
.vscode Add dev flake (#179) 2023-07-03 16:56:27 -04:00
dev chore: Fix broken link 2024-06-20 16:28:11 -04:00
doc chore(doc): Update flake.lock 2024-06-24 10:22:17 -04:00
example chore(example): Update flake.lock 2024-06-16 10:30:30 -04:00
nix fix: support older nixpkgs 2024-04-25 02:19:06 -04:00
test feat: Add granular settings defaults (#275) 2024-04-20 03:44:10 -04:00
.envrc envrc: reload on dev/flake.nix change 2024-03-27 15:26:59 -04:00
.gitignore Add dev flake (#179) 2023-07-03 16:56:27 -04:00
CHANGELOG.md fix: buildFromSdist default for haskell-flake managed packages only 2024-04-22 03:58:10 -04:00
flake.nix feat: Add granular settings defaults (#275) 2024-04-20 03:44:10 -04:00
justfile Nixify rundoc.sh 2024-02-29 17:47:17 -05:00
LICENSE Initial commit 2022-05-30 09:01:58 -04:00
README.md readme: add zulip badge 2024-02-21 12:12:33 -05:00

project chat Harmeless Code of Conduct

haskell-flake - Manage Haskell projects conveniently with Nix

There are several ways to manage Haskell packages using Nix with varying degrees of integration. haskell-flake makes Haskell development, packaging and deployment with Nix flakes a lot simpler than other existing approaches. This project is set up as a modern flake-parts module to integrate easily into other Nix projects and shell development environments in a lightweight and modular way.

To see more background information, guides and best practices, visit https://community.flake.parts/haskell-flake

Caveat: haskell-flake only supports the Haskell package manager Cabal, so your project must have a top-level .cabal file (single package project) or a cabal.project file (multi-package project).

Getting started

The minimal changes to your flake.nix to introduce the haskell-flake and flake-parts modules will look similar to:

# file: flake.nix
{
  inputs = {
    ...
    flake-parts.url = "github:hercules-ci/flake-parts";
    haskell-flake.url = "github:srid/haskell-flake";
  };

  outputs = inputs:
    inputs.flake-parts.lib.mkFlake { inherit inputs; } {
      systems = [ "x86_64-linux", ... ];
      imports = [
        ...
        inputs.haskell-flake.flakeModule
      ];
      perSystem = { self', system, lib, config, pkgs, ... }: {
        haskellProjects.default = {
          # basePackages = pkgs.haskellPackages;

          # Packages to add on top of `basePackages`, e.g. from Hackage
          packages = {
            aeson.source = "1.5.0.0" # Hackage version
          };

          # my-haskell-package development shell configuration
          devShell = {
            hlsCheck.enable = false;
          };

          # What should haskell-flake add to flake outputs?
          autoWire = [ "packages" "apps" "checks" ]; # Wire all but the devShell
        };

        devShells.default = pkgs.mkShell {
          name = "my-haskell-package custom development shell";
          inputsFrom = [
            ...
            config.haskellProjects.default.outputs.devShell
          ];
          nativeBuildInputs = with pkgs; [
            # other development tools.
          ];
        };
      };
    };
}

haskell-flake scans your folder automatically for a .cabal or cabal.project file. In this example an imaginary my-haskell-package.cabal project is used.

To see in more detail how to use haskell-flake in a realistic Haskell project with several other development tools, take a look at the corresponding Haskell single-package project Nix template and this Haskell multi-package project Nix example.

Documentation

https://community.flake.parts/haskell-flake

Discussion

Zulip is the primary venue for discussion; we also have Github Discussions enabled.