diff --git a/cabal-install/src/Distribution/Client/Nix.hs b/cabal-install/src/Distribution/Client/Nix.hs index 34a12f9157b..0a8d6a5c195 100644 --- a/cabal-install/src/Distribution/Client/Nix.hs +++ b/cabal-install/src/Distribution/Client/Nix.hs @@ -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 (..)) @@ -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 diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index 6a96fb54640..44224d9559b 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -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 [] diff --git a/doc/nix-integration.rst b/doc/nix-integration.rst index 6edf595b6f0..5d4fa695cd4 100644 --- a/doc/nix-integration.rst +++ b/doc/nix-integration.rst @@ -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.