Stack: --no-nix ignored on NixOS

Created on 2 Oct 2018  Â·  5Comments  Â·  Source: commercialhaskell/stack

General summary/comments (optional)

Executing stack on NixOS while passing --no-nix and --system-ghc ignores these flags and still tries to use stack's Nix integration.

Steps to reproduce

  1. Add the following files

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:
- '.'
  1. Execute the following command
$ 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

Expected stack to not enable Nix integration, but instead use the GHC provided by the Nix shell.

Actual

Stack attempts to activate Nix integration.

Stack version

$ 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).

Method of installation

Nix shell

nix

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mgsloan picture mgsloan  Â·  3Comments

abhinav picture abhinav  Â·  4Comments

sjakobi picture sjakobi  Â·  3Comments

s5k6 picture s5k6  Â·  3Comments

fizruk picture fizruk  Â·  3Comments