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

• Updated input 'cfp':
    'github:flake-parts/community.flake.parts/cc823f50d2d451d1402da5d79565d0809e339087?narHash=sha256-l7L%2B6Wz6HD3eRHqiq5udc9wo7EsUG5Ou3jJFY3uuVgQ%3D' (2024-05-29)
  → 'github:flake-parts/community.flake.parts/f08e69c563d09c1fa9e7c5d80b5edb249bbe48ce?narHash=sha256-KWEmyfAqRNRr7UG//zz8AMEusmZ4mfmuAYmKSYOtDNw%3D' (2024-06-06)
• Updated input 'cfp/haskell-flake':
    'github:srid/haskell-flake/5a86b9d5a1ad01e46d44af5fdaea59555b1199ca?narHash=sha256-opRlnyY/f041VPH4MxgUwq5bl821LbN5ugKMSlh8smc%3D' (2024-05-27)
  → 'github:srid/haskell-flake/cfb7db6b7b66cb7d1499dd53b8aeaa7c866f565f?narHash=sha256-ySll9pAYK78v8GY5wrCFLg2iMI6Ms/4tNfrvlMaUQ1M%3D' (2024-06-02)
• Updated input 'cfp/process-compose-flake':
    'github:Platonic-Systems/process-compose-flake/32c069e7ef436b4325ee36503cd02b2863eede53?narHash=sha256-kO8gcRHfuKIlsGmFoHUF4lD3CfrRBymIlG2R3OHBEjQ%3D' (2024-05-07)
  → 'github:Platonic-Systems/process-compose-flake/8a6fae467d4862f2be9aa2954ab2d1e324c399f4?narHash=sha256-EjmlQSBs6XxsOEk7KQSpk2m/mkRtUpH%2B%2BjZQix2jFgE%3D' (2024-06-06)
• Updated input 'cfp/services-flake':
    'github:juspay/services-flake/5d5e5fa514a220da9075414615554cd194691978?narHash=sha256-oEMynPWhXKvsisIpCP%2BPxfkZyK/4UnPiUo3K%2BJYBYio%3D' (2024-05-28)
  → 'github:juspay/services-flake/eb3bac5543951d06f79424f6c619a966c8c3d671?narHash=sha256-vqcKZxgBPhF7lGZdMGlzHKTMAboDK9D6SFrusME%2B6UY%3D' (2024-06-06)
• Updated input 'flake-parts-website':
    'github:hercules-ci/flake.parts-website/42682339b7ea71b3369e3ee95b881c13e27cb371?narHash=sha256-qxPAZZaLwCzohjPRYMImgsrW7rqxb/zFRyrmwCTqGyM%3D' (2024-06-01)
  → 'github:hercules-ci/flake.parts-website/4050c8fe047785cace8ebd328a95968634b94874?narHash=sha256-NL0LppO6TrQaK75RVHaBW/6WTvk1HlLemzepsISgjyo%3D' (2024-06-08)
• Updated input 'flake-parts-website/devshell':
    'github:numtide/devshell/12e914740a25ea1891ec619bb53cf5e6ca922e40?narHash=sha256-wtBhsdMJA3Wa32Wtm1eeo84GejtI43pMrFrmwLXrsEc%3D' (2024-04-19)
  → 'github:numtide/devshell/1ebbe68d57457c8cae98145410b164b5477761f4?narHash=sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY%3D' (2024-06-03)
• Updated input 'flake-parts-website/nix-cargo-integration':
    'github:yusdacra/nix-cargo-integration/a4095b7a3e0511bb98d3f122264b2adc60f9a4c0?narHash=sha256-RasV6LI/6487E6k/P5o9URiYGv1MOYMij%2Ba8ppAqzw4%3D' (2024-06-01)
  → 'github:yusdacra/nix-cargo-integration/9f50064e88ec062e1993d16b03297bfb23ece750?narHash=sha256-z2LAGGjRk7sYfotKLdNWmJLdGRplwgzLBD38z9h9Qcg%3D' (2024-06-08)
• Updated input 'flake-parts-website/nix-cargo-integration/parts':
    'github:hercules-ci/flake-parts/8dc45382d5206bd292f9c2768b8058a8fd8311d9?narHash=sha256-/GJvTdTpuDjNn84j82cU6bXztE0MSkdnTWClUCRub78%3D' (2024-05-16)
  → 'github:hercules-ci/flake-parts/2a55567fcf15b1b1c7ed712a2c6fadaec7412ea8?narHash=sha256-iKzJcpdXih14qYVcZ9QC9XuZYnPc6T8YImb6dX166kw%3D' (2024-06-01)
• Updated input 'flake-parts-website/nix-cargo-integration/rust-overlay':
    'github:oxalica/rust-overlay/ab69b67fac9a96709fbef0b899db308ca714a120?narHash=sha256-4gVhbC%2BNjSQ4c6cJvJGNCI1oTcD%2B8jRRNAnOF9faGCE%3D' (2024-06-01)
  → 'github:oxalica/rust-overlay/6dc3e45fe4aee36efeed24d64fc68b1f989d5465?narHash=sha256-wqbRwq3i7g5EHIui0bIi84mdqZ/It1AXBSLJ5tafD28%3D' (2024-06-08)
• Updated input 'flake-parts-website/nix-cargo-integration/treefmt':
    'github:numtide/treefmt-nix/03b982b77df58d5974c61c6022085bafe780c1cf?narHash=sha256-Hi09/RoizxubRf3PHToT2Nm7TL8B/abSVa6q82uEgNI%3D' (2024-05-31)
  → 'github:numtide/treefmt-nix/3eb96ca1ae9edf792a8e0963cc92fddfa5a87706?narHash=sha256-u10aDdYrpiGOLoxzY/mJ9llST9yO8Q7K/UlROoNxzDw%3D' (2024-06-01)
• Updated input 'flake-parts-website/pre-commit-hooks-nix':
    'github:cachix/pre-commit-hooks.nix/0e8fcc54b842ad8428c9e705cb5994eaf05c26a0?narHash=sha256-xrsYFST8ij4QWaV6HEokCUNIZLjjLP1bYC60K8XiBVA%3D' (2024-05-20)
  → 'github:cachix/pre-commit-hooks.nix/cc4d466cb1254af050ff7bdf47f6d404a7c646d1?narHash=sha256-7XfBuLULizXjXfBYy/VV%2BSpYMHreNRHk9nKMsm1bgb4%3D' (2024-06-06)
• Updated input 'flake-parts-website/treefmt-nix':
    'github:numtide/treefmt-nix/03b982b77df58d5974c61c6022085bafe780c1cf?narHash=sha256-Hi09/RoizxubRf3PHToT2Nm7TL8B/abSVa6q82uEgNI%3D' (2024-05-31)
  → 'github:numtide/treefmt-nix/4fc1c45a5f50169f9f29f6a98a438fb910b834ed?narHash=sha256-npYqVg%2BWk4oxnWrnVG7416fpfrlRhp/lQ6wQ4DHI8YE%3D' (2024-06-08)
• Updated input 'haskell-flake':
    'github:srid/haskell-flake/5a86b9d5a1ad01e46d44af5fdaea59555b1199ca?narHash=sha256-opRlnyY/f041VPH4MxgUwq5bl821LbN5ugKMSlh8smc%3D' (2024-05-27)
  → 'github:srid/haskell-flake/cfb7db6b7b66cb7d1499dd53b8aeaa7c866f565f?narHash=sha256-ySll9pAYK78v8GY5wrCFLg2iMI6Ms/4tNfrvlMaUQ1M%3D' (2024-06-02)
2024-06-09 00:17:48 +00:00
.github/workflows chore(ci): use good commit message 2024-04-22 05:43:51 -04:00
.vscode Add dev flake (#179) 2023-07-03 16:56:27 -04:00
dev dev: explicitly use haskell-flake input 2024-03-27 15:27:24 -04:00
doc chore(doc): Update flake.lock 2024-06-09 00:17:48 +00:00
example chore(example): Update flake.lock 2024-06-02 10:45:01 -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.