flake-parts
Nix module for Haskell development
35575466a0
Flake lock file updates: • Updated input 'cfp': 'github:flake-parts/community.flake.parts/74afb725610c499236b53906e36d15ea25602b2d?narHash=sha256-%2BkOwBJfFCEF/8A1kH2lCR0oXsru2BGwfTC9reS/CJr4%3D' (2024-04-20) → 'github:flake-parts/community.flake.parts/1b2a974c8c48a11e5fde624940cc44e0cd8368e3?narHash=sha256-JKSm6ZRNKHzNbRDbkXu0d9d27LE1nDLDdI/arnVmTdU%3D' (2024-04-26) • Updated input 'cfp/haskell-flake': 'github:srid/haskell-flake/53e434d194f08c5ef9b2ba448b250f0321e6d529?narHash=sha256-TDnvGInwe24zqhUVmQOLt3EkfP9vVpWIwfScJPopTg0%3D' (2024-04-20) → 'github:srid/haskell-flake/2ee7904390ce78a81d0f66fcc98bf4c32d128d33?narHash=sha256-R2k/UG5XtyTtmezRs0HZZ9MlvhWXtkyHR%2BngEAWrtZI%3D' (2024-04-25) • Updated input 'cfp/hercules-ci-effects': 'github:hercules-ci/hercules-ci-effects/64e7763d72c1e4c1e5e6472640615b6ae2d40fbf?narHash=sha256-Xjf8BdnQG0tLhPMlqQdwCIjOp7Teox0DP3N/jjyiGM4%3D' (2024-03-15) → 'github:hercules-ci/hercules-ci-effects/c0302ec12d569532a6b6bd218f698bc402e93adc?narHash=sha256-6q6ojsp/Z9P2goqnxyfCSzFOD92T3Uobmj8oVAicUOs%3D' (2024-04-23) • Updated input 'cfp/hercules-ci-effects/flake-parts': 'github:hercules-ci/flake-parts/f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2?narHash=sha256-Dt/wOWeW6Sqm11Yh%2B2%2Bt0dfEWxoMxGBvv3JpIocFl9E%3D' (2024-03-01) → 'github:hercules-ci/flake-parts/9126214d0a59633752a136528f5f3b9aa8565b7d?narHash=sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm%2BGpZNw%3D' (2024-04-01) • Updated input 'cfp/hercules-ci-effects/nixpkgs': 'github:NixOS/nixpkgs/0ad13a6833440b8e238947e47bea7f11071dc2b2?narHash=sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC%2BfhQ%3D' (2024-03-12) → 'github:NixOS/nixpkgs/6143fc5eeb9c4f00163267708e26191d1e918932?narHash=sha256-%2Bz/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y%3D' (2024-04-21) • Updated input 'cfp/process-compose-flake': 'github:Platonic-Systems/process-compose-flake/522b77b195d039a6fdb98d86447f9fba8a6efbce?narHash=sha256-act5Q5zSruTmwKMrZQeFAwWVxARAkYx96Ed423jDWFM%3D' (2024-04-12) → 'github:Platonic-Systems/process-compose-flake/ee8cd505f08f6cd691930e70987a306b7726851b?narHash=sha256-pQIg3wrNBDdRiuhcVC8DFmTXK8GHtR%2BiV%2B5Gvsozx5s%3D' (2024-04-24) • Updated input 'cfp/services-flake': 'github:juspay/services-flake/4d363b6d22b5ee9763c2e94e72c13505849b9625?narHash=sha256-r5gZ8sqk3BamCFEc%2BzaJJkcwEGLEDcOMgBU2A1mU%2BBA%3D' (2024-04-14) → 'github:juspay/services-flake/dbb93b39ce83530e6f86daa46c671055f224816d?narHash=sha256-%2BgszdjbWWt5m%2B77weTSk9l67Z4cUAmDLp%2BucjJViEpc%3D' (2024-04-26) • Updated input 'flake-parts-website': 'github:hercules-ci/flake.parts-website/c4a687b1f70e6d25a87c707c0693e2b11d2de80d?narHash=sha256-EIvukrUXs53WaEXDWpz7xMSfz845HVwoOnq9vZvWCkA%3D' (2024-04-20) → 'github:hercules-ci/flake.parts-website/a29d5114464ca6f0c58f1ed6a3c266fdd3cea97a?narHash=sha256-RIHQfDQjD5CciYb0TPRJ%2BdLnfSTqIHRKtUo5O6iKXuw%3D' (2024-04-27) • Updated input 'flake-parts-website/hercules-ci-effects': 'github:hercules-ci/hercules-ci-effects/64e7763d72c1e4c1e5e6472640615b6ae2d40fbf?narHash=sha256-Xjf8BdnQG0tLhPMlqQdwCIjOp7Teox0DP3N/jjyiGM4%3D' (2024-03-15) → 'github:hercules-ci/hercules-ci-effects/c0302ec12d569532a6b6bd218f698bc402e93adc?narHash=sha256-6q6ojsp/Z9P2goqnxyfCSzFOD92T3Uobmj8oVAicUOs%3D' (2024-04-23) • Updated input 'flake-parts-website/hercules-ci-effects/flake-parts': 'github:hercules-ci/flake-parts/f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2?narHash=sha256-Dt/wOWeW6Sqm11Yh%2B2%2Bt0dfEWxoMxGBvv3JpIocFl9E%3D' (2024-03-01) → 'github:hercules-ci/flake-parts/9126214d0a59633752a136528f5f3b9aa8565b7d?narHash=sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm%2BGpZNw%3D' (2024-04-01) • Updated input 'flake-parts-website/hercules-ci-effects/nixpkgs': 'github:NixOS/nixpkgs/0ad13a6833440b8e238947e47bea7f11071dc2b2?narHash=sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC%2BfhQ%3D' (2024-03-12) → 'github:NixOS/nixpkgs/6143fc5eeb9c4f00163267708e26191d1e918932?narHash=sha256-%2Bz/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y%3D' (2024-04-21) • Updated input 'flake-parts-website/nix-cargo-integration': 'github:yusdacra/nix-cargo-integration/88de96660da568a0a2fbed4495e6a553d026edc3?narHash=sha256-TPv5fOawk5EgAZ1jTGFRdXBVXKhWSuFWWUQatqX3Gt4%3D' (2024-04-20) → 'github:yusdacra/nix-cargo-integration/370d0ff9f97edb363f08af17dadaed3928ee1942?narHash=sha256-5Xl7tJjG1GBTT8evOXehNAIZoZ8W5EtLlqiYjMPNUlI%3D' (2024-04-27) • Updated input 'flake-parts-website/nix-cargo-integration/rust-overlay': 'github:oxalica/rust-overlay/67e961704b80454f1ba6595b02e26afc9af4cdce?narHash=sha256-j/lrqFNzm7SdlBlKX43kA2Wp0OaGVOUjQGnER9//4Ao%3D' (2024-04-20) → 'github:oxalica/rust-overlay/2a42c742ab04b61d9b2f1edf392842cf9f27ebfd?narHash=sha256-044xbpBszupqN3nl/CGOCJtTQ4O6Aca81mJpX45i8/I%3D' (2024-04-26) • Updated input 'flake-parts-website/nix-cargo-integration/treefmt': 'github:numtide/treefmt-nix/49dc4a92b02b8e68798abd99184f228243b6e3ac?narHash=sha256-N3QDhoaX%2BpaWXHbEXZapqd1r95mdshxToGowtjtYkGI%3D' (2024-04-01) → 'github:numtide/treefmt-nix/c6aaf729f34a36c445618580a9f95a48f5e4e03f?narHash=sha256-Qv4RBm4LKuO4fNOfx9wl40W2rBbv5u5m%2BwhxRYUMiaA%3D' (2024-04-25) • Updated input 'flake-parts-website/pre-commit-hooks-nix': 'github:cachix/pre-commit-hooks.nix/40e6053ecb65fcbf12863338a6dcefb3f55f1bf8?narHash=sha256-nMirxrGteNAl9sWiOhoN5tIHyjBbVi5e2tgZUgZlK3Y%3D' (2024-04-12) → 'github:cachix/pre-commit-hooks.nix/6fb82e44254d6a0ece014ec423cb62d92435336f?narHash=sha256-RWFafuSb5nkWGu8dDbW7gVb8FOQOPqmX/9MlxUUDguw%3D' (2024-04-24) • Updated input 'flake-parts-website/treefmt-nix': 'github:numtide/treefmt-nix/49dc4a92b02b8e68798abd99184f228243b6e3ac?narHash=sha256-N3QDhoaX%2BpaWXHbEXZapqd1r95mdshxToGowtjtYkGI%3D' (2024-04-01) → 'github:numtide/treefmt-nix/c6aaf729f34a36c445618580a9f95a48f5e4e03f?narHash=sha256-Qv4RBm4LKuO4fNOfx9wl40W2rBbv5u5m%2BwhxRYUMiaA%3D' (2024-04-25) • Updated input 'haskell-flake': 'github:srid/haskell-flake/e43bc631b413078ffe7b772850005596f7295050?narHash=sha256-kli8vgOyXls7HX%2BRSARDJztSJLiiFImyaogkg4EpefY%3D' (2024-04-21) → 'github:srid/haskell-flake/2ee7904390ce78a81d0f66fcc98bf4c32d128d33?narHash=sha256-R2k/UG5XtyTtmezRs0HZZ9MlvhWXtkyHR%2BngEAWrtZI%3D' (2024-04-25) |
||
---|---|---|
.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
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.