Executing stack on NixOS while passing --no-nix and --system-ghc ignores these flags and still tries to use stack's Nix integration.
shell.nix
nixpkgs = (import <nixpkgs> {}).fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs-channels";
rev = "89b618771ad4b0cfdb874dee3d51eb267c4257dd";
sha256 = "0jlyggy7pvqj2a6iyn44r7pscz9ixjb6fn6s4ssvahfywsncza6y";
};
in
with (import nixpkgs {});
{ }:
mkShell {
inputsFrom = [
];
nativeBuildInputs = [
haskell.packages.ghc861.ghc stack
];
}
stack.yaml
resolver: nightly-2018-09-29
packages:
- '.'
$ nix-shell --run 'stack --no-nix --system-ghc build'
Note: Enabling Nix integration, as it is required under NixOS
error: attribute 'ghc861' missing, at (string):1:48
(use '--show-trace' to show detailed location information)
Expected stack to not enable Nix integration, but instead use the GHC provided by the Nix shell.
Stack attempts to activate Nix integration.
$ nix-shell --run 'stack --version'
Version 1.7.1 x86_64
This is the latest stack version available on the latest nixpkgs-unstable revision at the time of writing (see shell.nix above).
Nix shell
I think Note: Enabling Nix integration, as it is required under NixOS means that this is the intended behaviour. Possibly a more prominent message could be added with a link to a document that explains why this is so.
@turion I think the message is phrasing this too strongly. For stack to default to Nix integration on NixOS is reasonable behaviour. But, it should be possible to override and disable Nix integration on NixOS. See also https://github.com/commercialhaskell/stack/issues/4002 for a previously resolved instance of this issue.
I think this is not fixed in 1.7.1 at all.
Indeed, @ip1981 — well spotted. @ahermann please try the most recent version of stack. Do re-open if this is still an issue after that.
I can confirm that the issue is resolved with stack version 1.9.1.