haskell / haskell/cabal

feature request: Nix Integration support for `flake.nix`

Open
#9,046 7 comments 0 reactions 0 assignees View on GitHub
cabal-install: nix integration type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

Currently

> If the package (which must be locally unpacked) provides a `shell.nix` or `default.nix` file, this flag will cause `cabal` to run most commands through `nix-shell`. If both expressions are present, `shell.nix` is preferred.

https://cabal.readthedocs.io/en/stable/nix-integration.html#nix-integration

`flake.nix` can do everything that `shell.nix` and `default.nix` can do, as I understand it. Some projects only have `flake.nix`.

Can we support Nix Flake Integration in Cabal?

------------------------------------------

Question:

- Using Cabal's Nix Integration feature as it works today, provided a `default.nix` is present, will Cabal pull Haskell library dependencies from the Nix project?

or

- Is Cabal's Nix Integration intended to provide system dependencies like `openssl` or `libjpeg`?

or

- both?

If Cabal's Nix Integration is intended to provide system dependencies, not Haskell library dependencies, I think Nix Flake Integration is unnecessary. The reason is, working in a `nix develop` shell provided by `flake.nix`, Cabal will already have access to the system dependencies provided by `flake.nix`.

Contributor guide

Open the contributing guide

Research direction

Start with Cabal's Nix Integration documentation, especially the existing shell.nix/default.nix behavior. Determine whether integration covers Haskell dependencies, system dependencies, or both, then define the flake.nix behavior and verify it against an existing Nix-backed Cabal workflow.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.