flake-parts
Nix module for Haskell development
Flake lock file updates: • Updated input 'cfp': 'github:flake-parts/community.flake.parts/76edcd33f1d9d8dc387a35d5ae7d413fde1ef94b?narHash=sha256-2orBLFCI7h9fpo9kkjRGygSZIerzuFdptSTtV9M7Npw%3D' (2024-07-06) → 'github:flake-parts/community.flake.parts/4b72ca8d7a37d9c64cc40863f236998d789017ed?narHash=sha256-zhqCTDr/jRbuR6jcS3AGPP/7MQXWNieYz9aJrwNVSBs%3D' (2024-07-10) • Updated input 'cfp/haskell-flake': 'github:srid/haskell-flake/64bd0f328e5a424b65aafdde3901b64f4f390b0f?narHash=sha256-MtatlRdAy7eWdgZI8JgW/OmY/aqF%2BSvRucqlsLHzX80%3D' (2024-07-03) → 'github:srid/haskell-flake/a1506861ce09cca2d233d014fd03dd97ed03e3b9?narHash=sha256-U1vZkKOy7bB/qMRwS8cz4c8sy68Jq8yzRMV4G40U3Us%3D' (2024-07-07) • Updated input 'cfp/services-flake': 'github:juspay/services-flake/b02b6c802548cb7814cd4d03098d1414c99652b9?narHash=sha256-vvVMtCXzCSlGnFV4pJlAsekCC72WRRM0Aa/tlkx4e4w%3D' (2024-07-06) → 'github:juspay/services-flake/340d1a94cc5770c9fd921371f5c642367dc2e4d0?narHash=sha256-sv6DbDQ0gYvGatAQTUeb2GR1IvIAmQxW5OXBLrBwEKc%3D' (2024-07-09) • Updated input 'flake-parts-website': 'github:hercules-ci/flake.parts-website/9c33cf14dd5c2b5ebd0d56f7560d59f409f53ba5?narHash=sha256-LODA4TMEqei2roAaTHz9%2BhcuY4lQv2KC84DdJf9Z05w%3D' (2024-07-06) → 'github:hercules-ci/flake.parts-website/62ed4f98b3709f78c4af86527b06099d2a61e9ae?narHash=sha256-7pxk8AD%2B3Dq0OXc5OqrRPPo2ofOHQ6SrWnah2%2Bh7VH4%3D' (2024-07-13) • Updated input 'flake-parts-website/agenix-rekey': 'github:oddlama/agenix-rekey/4551006c2807ab361ea4db5e171afb4798da4fc2?narHash=sha256-vN/pfiAzYH4i3cUb5pLqkXgPoAPtaxjUXv5aRpbKShU%3D' (2024-06-09) → 'github:oddlama/agenix-rekey/c071067f7d972552f5170cf8665643ed0ec19a6d?narHash=sha256-vI92Y%2Bf4iTDsoy%2Bxg0n0I/bIY1xatvZ807spIgTjTc0%3D' (2024-07-08) • Updated input 'flake-parts-website/nix-cargo-integration': 'github:yusdacra/nix-cargo-integration/74ce1ba52ecdc6b5a2ab845eea94bb2d80d21074?narHash=sha256-qh1Thi7tQdqSFwKUxNhlh4uog2p3DuqTw1SUZJpo1/A%3D' (2024-07-06) → 'github:yusdacra/nix-cargo-integration/070925af393f15d0b3895ad5d8501e6d9288bac2?narHash=sha256-P0LN%2BBNaFGE4rwp2/5PwSeNYC%2BTX/pxGQxieZc%2BC0go%3D' (2024-07-13) • Updated input 'flake-parts-website/nix-cargo-integration/rust-overlay': 'github:oxalica/rust-overlay/05ccbe21233d4e9110fc6428d2c3d74b430c3c69?narHash=sha256-eR5glZHS2bLpzUgTDhWGm04j%2Bj5KMYKoDsY5DXAiuKQ%3D' (2024-07-06) → 'github:oxalica/rust-overlay/92f0608ab66c9770e931056b1c7a1b6249dbc43a?narHash=sha256-WMwo/kZ3o2h5Bls4dEyQ3XFZ4nw2UbbOUFpq3aVlkms%3D' (2024-07-13) • Updated input 'flake-parts-website/nix-cargo-integration/treefmt': 'github:numtide/treefmt-nix/bdb6355009562d8f9313d9460c0d3860f525bc6c?narHash=sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII%2BXXHDHqek%3D' (2024-07-02) → 'github:numtide/treefmt-nix/5b002f8a53ed04c1a4177e7b00809d57bd2c696f?narHash=sha256-f52x9srIcqQm1Df3T%2BxYR5P6VfdnDFa2vkkcLhlTp6U%3D' (2024-07-12) • Updated input 'flake-parts-website/pre-commit-hooks-nix': 'github:cachix/pre-commit-hooks.nix/0ff4381bbb8f7a52ca4a851660fc7a437a4c6e07?narHash=sha256-F1h%2BXIsGKT9TkGO3omxDLEb/9jOOsI6NnzsXFsZhry4%3D' (2024-06-24) → 'github:cachix/pre-commit-hooks.nix/8d6a17d0cdf411c55f12602624df6368ad86fac1?narHash=sha256-ni/87oHPZm6Gv0ECYxr1f6uxB0UKBWJ6HvS7lwLU6oY%3D' (2024-07-09) • Updated input 'flake-parts-website/pre-commit-hooks-nix/nixpkgs-stable': 'github:NixOS/nixpkgs/03d771e513ce90147b65fe922d87d3a0356fc125?narHash=sha256-0Y8IrGhRmBmT7HHXlxxepg2t8j1X90%2B%2BqRN3lukGaIk%3D' (2024-06-19) → 'github:NixOS/nixpkgs/194846768975b7ad2c4988bdb82572c00222c0d7?narHash=sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo%3D' (2024-07-07) • Updated input 'flake-parts-website/std': 'github:divnix/std/b6924a7d37a46fc1dda8efe405040e27ecf1bbd6?narHash=sha256-LcLYV5CDhIiJs3MfxGZFKsXPR4PtfnY4toZ75GM%2B2Pw%3D' (2024-05-08) → 'github:divnix/std/4e20f558f00bc8d52b0fadc468b872d280ca2d34?narHash=sha256-8HgfMr07vNTB2xp%2BvRBVmJ0A6ctX/oa/QqFBlqqmz4M%3D' (2024-07-06) • Updated input 'flake-parts-website/treefmt-nix': 'github:numtide/treefmt-nix/bdb6355009562d8f9313d9460c0d3860f525bc6c?narHash=sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII%2BXXHDHqek%3D' (2024-07-02) → 'github:numtide/treefmt-nix/5b002f8a53ed04c1a4177e7b00809d57bd2c696f?narHash=sha256-f52x9srIcqQm1Df3T%2BxYR5P6VfdnDFa2vkkcLhlTp6U%3D' (2024-07-12) • Updated input 'haskell-flake': 'github:srid/haskell-flake/64bd0f328e5a424b65aafdde3901b64f4f390b0f?narHash=sha256-MtatlRdAy7eWdgZI8JgW/OmY/aqF%2BSvRucqlsLHzX80%3D' (2024-07-03) → 'github:srid/haskell-flake/a1506861ce09cca2d233d014fd03dd97ed03e3b9?narHash=sha256-U1vZkKOy7bB/qMRwS8cz4c8sy68Jq8yzRMV4G40U3Us%3D' (2024-07-07) |
||
---|---|---|
.github/workflows | ||
.vscode | ||
dev | ||
doc | ||
example | ||
nix | ||
test | ||
.envrc | ||
.gitignore | ||
CHANGELOG.md | ||
flake.nix | ||
justfile | ||
LICENSE | ||
README.md |
haskell-flake - Manage Haskell projects conveniently with Nix
![](/srid/haskell-flake/media/branch/update_flake_lock_doc/doc/haskell-flake.webp)
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.