Skip to content

Commit

Permalink
Merge pull request #9205 from yvan-sraka/deprecate-nix-integration
Browse files Browse the repository at this point in the history
Add deprecation warnings to Nix integration
  • Loading branch information
mergify[bot] authored Sep 6, 2023
2 parents f3ef4bd + 5581ff5 commit 00bbb66
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion cabal-install/src/Distribution/Client/Nix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import Distribution.Simple.Program
, simpleProgram
)
import Distribution.Simple.Setup (fromFlagOrDefault)
import Distribution.Simple.Utils (debug, existsAndIsMoreRecentThan)
import Distribution.Simple.Utils (debug, existsAndIsMoreRecentThan, warn)

import Distribution.Client.Config (SavedConfig (..))
import Distribution.Client.GlobalFlags (GlobalFlags (..))
Expand Down Expand Up @@ -144,6 +144,9 @@ nixShell verb dist globalFlags config go = do
findNixExpr globalFlags config >>= \case
Nothing -> go
Just shellNix -> do
-- Nix integration never worked with cabal-install v2 commands ...
warn verb "Nix integration has been deprecated and will be removed in a future release. You can learn more about it here: https://cabal.readthedocs.io/en/latest/nix-integration.html"

let prog = simpleProgram "nix-shell"
progdb <- configureOneProgram verb prog

Expand Down
6 changes: 3 additions & 3 deletions cabal-install/src/Distribution/Client/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -502,17 +502,17 @@ globalCommand commands =
)
""
["nix"] -- Must be empty because we need to return PP.empty from viewAsFieldDescr
"Nix integration: run commands through nix-shell if a 'shell.nix' file exists (default is False)"
"[DEPRECATED] Nix integration: run commands through nix-shell if a 'shell.nix' file exists (default is False)"
, noArg
(Flag True)
[]
["enable-nix"]
"Enable Nix integration: run commands through nix-shell if a 'shell.nix' file exists"
"[DEPRECATED] Enable Nix integration: run commands through nix-shell if a 'shell.nix' file exists"
, noArg
(Flag False)
[]
["disable-nix"]
"Disable Nix integration"
"[DEPRECATED] Disable Nix integration"
]
, option
[]
Expand Down
9 changes: 9 additions & 0 deletions doc/nix-integration.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Nix Integration
===============

.. warning::

Nix integration has been deprecated and will be removed in a future release.

The original mechanism can still be easily replicated with the following commands:

- for a ``shell.nix``: ``nix-shell --run "cabal ..."``
- for a ``flake.nix``: ``nix develop -c cabal ...``

.. note::

This functionality doesn't work with nix-style builds.
Expand Down

0 comments on commit 00bbb66

Please sign in to comment.