Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Give an example for --enable-nix flag #8333

Merged
merged 3 commits into from
Aug 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions doc/nix-integration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,25 @@ Nix Integration
Enabling Nix Integration
------------------------

To enable Nix integration, simply pass the ``--enable-nix`` global
option when you call ``cabal``. To use this option everywhere, edit
your :ref:`global configuration file<config-file-discovery>`
(default: ``$HOME/.cabal/config``) to include:
To enable Nix integration, simply pass the ``--enable-nix`` global option when you call ``cabal`` (eg. ``cabal --enable-nix v1-build``).
To use this option everywhere, edit your :ref:`global configuration file<config-file-discovery>` (default: ``$HOME/.cabal/config``) to include:

.. code-block:: cabal

nix: True

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. The following commands are affected:

- ``cabal configure``
- ``cabal build``
- ``cabal repl``
- ``cabal install`` (only if installing into a sandbox)
- ``cabal haddock``
- ``cabal freeze``
- ``cabal gen-bounds``
- ``cabal run``
- ``cabal v1-configure``
- ``cabal v1-build``
- ``cabal v1-repl``
- ``cabal v1-install`` (only if installing into a sandbox)
- ``cabal v1-haddock``
- ``cabal v1-freeze``
- ``cabal v1-gen-bounds``
- ``cabal v1-run``

If the package does not provide an expression, ``cabal`` runs normally.
If the package does not provide a Nix expression, ``cabal`` runs normally.

Creating Nix Expressions
------------------------
Expand Down