flake-parts
Nix module for Haskell development
Flake lock file updates: • Updated input 'cfp': 'github:flake-parts/community.flake.parts/f08e69c563d09c1fa9e7c5d80b5edb249bbe48ce?narHash=sha256-KWEmyfAqRNRr7UG//zz8AMEusmZ4mfmuAYmKSYOtDNw%3D' (2024-06-06) → 'github:flake-parts/community.flake.parts/4e046a4fe52d09819d6698df39e5089cc4c65c6e?narHash=sha256-oomu5equUoWYQJuuxeUebhe9ekAGAMmBew3CQEolAQs%3D' (2024-06-15) • Updated input 'cfp/haskell-flake': 'github:srid/haskell-flake/cfb7db6b7b66cb7d1499dd53b8aeaa7c866f565f?narHash=sha256-ySll9pAYK78v8GY5wrCFLg2iMI6Ms/4tNfrvlMaUQ1M%3D' (2024-06-02) → 'github:srid/haskell-flake/8bffb2266b38fe7983d14fc4858aea2e64ad2175?narHash=sha256-h9cBnB1hfF73g/K7FJtsOdcE0mbi00qBGCJ%2BCFH7jRQ%3D' (2024-06-09) • Updated input 'cfp/hercules-ci-effects': 'github:hercules-ci/hercules-ci-effects/c0302ec12d569532a6b6bd218f698bc402e93adc?narHash=sha256-6q6ojsp/Z9P2goqnxyfCSzFOD92T3Uobmj8oVAicUOs%3D' (2024-04-23) → 'github:hercules-ci/hercules-ci-effects/0ab08b23ce3c3f75fe9a5598756b6fb8bcf0b414?narHash=sha256-03rLBd/lKecgaKz0j5ESUf9lDn5R0SJatZTKLL5unWE%3D' (2024-06-10) • Updated input 'cfp/nixos-flake': 'github:srid/nixos-flake/aa9100167350cbdffaa272b0fd382d7c23606b86?narHash=sha256-qHjJ6alc4o3p51hrPp3JGdC5Pbz5EjF%2BUZq1HbK8av0%3D' (2024-05-22) → 'github:srid/nixos-flake/c23ce31c707c3e4b699312ab9c80a4a003e893b1?narHash=sha256-Bom7owfn/piwRum%2BVmsRSGAjvnlhDEeE60IONzIQffs%3D' (2024-06-11) • Updated input 'cfp/process-compose-flake': 'github:Platonic-Systems/process-compose-flake/8a6fae467d4862f2be9aa2954ab2d1e324c399f4?narHash=sha256-EjmlQSBs6XxsOEk7KQSpk2m/mkRtUpH%2B%2BjZQix2jFgE%3D' (2024-06-06) → 'github:Platonic-Systems/process-compose-flake/9344fac44edced4c686721686a6ad904d067c546?narHash=sha256-%2BRrlkAVZx0QhyeHAGFJnjST%2B/7Dc3zsDU3zAKXoDXaI%3D' (2024-06-10) • Updated input 'cfp/services-flake': 'github:juspay/services-flake/eb3bac5543951d06f79424f6c619a966c8c3d671?narHash=sha256-vqcKZxgBPhF7lGZdMGlzHKTMAboDK9D6SFrusME%2B6UY%3D' (2024-06-06) → 'github:juspay/services-flake/107e8f43fb0453105d161e80fbc485d7b19eb401?narHash=sha256-RpMH7512W%2BvI4/h%2B/TO%2BjEu0gXZ9mhdoLdu4pi8mtxs%3D' (2024-06-15) • Updated input 'flake-parts-website': 'github:hercules-ci/flake.parts-website/4050c8fe047785cace8ebd328a95968634b94874?narHash=sha256-NL0LppO6TrQaK75RVHaBW/6WTvk1HlLemzepsISgjyo%3D' (2024-06-08) → 'github:hercules-ci/flake.parts-website/a685938f82639afd3ebc340eb786ea53c4587cea?narHash=sha256-G1DGDwXKBo/TNUGuWIXuwC5mw7lkJ6GfWc%2BtFRfaUUg%3D' (2024-06-15) • Updated input 'flake-parts-website/agenix-rekey': 'github:oddlama/agenix-rekey/c6c1ca5b9ceaaa40fd979fb25bb7043adf4554ad?narHash=sha256-PHyHgQL5/b0%2BA/kmNCHVOM/WSJSGe1jZ%2BLFWfYNx31E%3D' (2024-05-29) → 'github:oddlama/agenix-rekey/4551006c2807ab361ea4db5e171afb4798da4fc2?narHash=sha256-vN/pfiAzYH4i3cUb5pLqkXgPoAPtaxjUXv5aRpbKShU%3D' (2024-06-09) • Updated input 'flake-parts-website/hercules-ci-effects': 'github:hercules-ci/hercules-ci-effects/c0302ec12d569532a6b6bd218f698bc402e93adc?narHash=sha256-6q6ojsp/Z9P2goqnxyfCSzFOD92T3Uobmj8oVAicUOs%3D' (2024-04-23) → 'github:hercules-ci/hercules-ci-effects/0ab08b23ce3c3f75fe9a5598756b6fb8bcf0b414?narHash=sha256-03rLBd/lKecgaKz0j5ESUf9lDn5R0SJatZTKLL5unWE%3D' (2024-06-10) • Updated input 'flake-parts-website/nix-cargo-integration': 'github:yusdacra/nix-cargo-integration/9f50064e88ec062e1993d16b03297bfb23ece750?narHash=sha256-z2LAGGjRk7sYfotKLdNWmJLdGRplwgzLBD38z9h9Qcg%3D' (2024-06-08) → 'github:yusdacra/nix-cargo-integration/d216df369341dfd0aa18380a2a610466f05a0b3d?narHash=sha256-DLx43OzkHitAjTVVWOyBx13CuEH50EAIaSdxbHhnb88%3D' (2024-06-15) • Updated input 'flake-parts-website/nix-cargo-integration/rust-overlay': 'github:oxalica/rust-overlay/6dc3e45fe4aee36efeed24d64fc68b1f989d5465?narHash=sha256-wqbRwq3i7g5EHIui0bIi84mdqZ/It1AXBSLJ5tafD28%3D' (2024-06-08) → 'github:oxalica/rust-overlay/7c2d603cb67c974ef8c5cfee1150060dbb299e04?narHash=sha256-s8QrTANEtY6UxzfkcBfoN93bgW9aCRIq54LPRVNu/4c%3D' (2024-06-15) • Updated input 'flake-parts-website/nix-cargo-integration/treefmt': 'github:numtide/treefmt-nix/3eb96ca1ae9edf792a8e0963cc92fddfa5a87706?narHash=sha256-u10aDdYrpiGOLoxzY/mJ9llST9yO8Q7K/UlROoNxzDw%3D' (2024-06-01) → 'github:numtide/treefmt-nix/e75ba0a6bb562d2ce275db28f6a36a2e4fd81391?narHash=sha256-35hUMmFesmchb%2Bu7heKHLG5B6c8fBOcSYo0jj0CHLes%3D' (2024-06-13) • Updated input 'flake-parts-website/treefmt-nix': 'github:numtide/treefmt-nix/4fc1c45a5f50169f9f29f6a98a438fb910b834ed?narHash=sha256-npYqVg%2BWk4oxnWrnVG7416fpfrlRhp/lQ6wQ4DHI8YE%3D' (2024-06-08) → 'github:numtide/treefmt-nix/e75ba0a6bb562d2ce275db28f6a36a2e4fd81391?narHash=sha256-35hUMmFesmchb%2Bu7heKHLG5B6c8fBOcSYo0jj0CHLes%3D' (2024-06-13) • Updated input 'haskell-flake': 'github:srid/haskell-flake/cfb7db6b7b66cb7d1499dd53b8aeaa7c866f565f?narHash=sha256-ySll9pAYK78v8GY5wrCFLg2iMI6Ms/4tNfrvlMaUQ1M%3D' (2024-06-02) → 'github:srid/haskell-flake/8bffb2266b38fe7983d14fc4858aea2e64ad2175?narHash=sha256-h9cBnB1hfF73g/K7FJtsOdcE0mbi00qBGCJ%2BCFH7jRQ%3D' (2024-06-09) |
||
---|---|---|
.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/commit/56b2070875b79188562d06212b0b3a091ef7e680/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.