Skip to content

Commit

Permalink
Add deprecation warnings to Nix integration
Browse files Browse the repository at this point in the history
  • Loading branch information
yvan-sraka committed Sep 2, 2023
1 parent 30bb110 commit 51b92ee
Show file tree
Hide file tree
Showing 5 changed files with 18 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 @@ -141,6 +141,9 @@ nixShell verb dist globalFlags config go = do
if alreadyInShell
then go
else 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"

findNixExpr globalFlags config >>= \case
Nothing -> go
Just shellNix -> do
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
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/Freeze/enable-benchmarks.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# cabal v1-freeze
Warning: 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
Resolving dependencies...
1 change: 1 addition & 0 deletions cabal-testsuite/PackageTests/Freeze/enable-tests.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# cabal v2-update
Downloading the latest package list from test-local-repo
# cabal v1-freeze
Warning: 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
Resolving dependencies...
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 51b92ee

Please sign in to comment.