Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executable named git not found on path #11

Closed
jmitchell opened this issue Jun 7, 2017 · 6 comments
Closed

Executable named git not found on path #11

jmitchell opened this issue Jun 7, 2017 · 6 comments
Labels

Comments

@jmitchell
Copy link
Contributor

On a nixos machine I'm seeing that having the following in ~/.stack/config.yaml causes a runtime failure.

nix:
  enable: true

From outside a nix-shell:

$ stack2nix -o /tmp/haskell-multi-package-demo1.nix --revision e3d9bd6d6066dab5222ce53fb7d234f28eafa2d5 https://github.com/jmitchell/haskell-multi-package-demo1.git
Updating deps from /tmp/s2n-25091
stack2nix: FAILED: stack list-dependencies
Command failed: cd "/tmp/s2n-25091" && stack list-dependencies --system-ghc --separator -
Executable named git not found on path: ["/home/jake/.stack/snapshots/x86_64-linux-nix/lts-8.9/8.0.2/bin","/nix/store/dvlcd6yb874y5y1jkw99mxrrpwh7dn6a-ghc-8.0.2/bin","/nix/store/29cj9f40783rkqzzmp2n70rbzfvnmykk-patchelf-0.9/bin","/nix/store/b28rci2pd2bjrcgj76x594phflbd6sv8-paxctl-0.9/bin","/nix/store/k8dyhz9hrjydl23ny3131am6cws1rc07-coreutils-8.26/bin","/nix/store/dqzqrrampaf665laggc4ng33dfbxv5q7-findutils-4.6.0/bin","/nix/store/2arb589k64xmjfw3aa819dz5iqxiyqrd-diffutils-3.5/bin","/nix/store/2nzkvn5b9jxdj75mgw6cdvpl6438sdqw-gnused-4.4/bin","/nix/store/3r21p23hmbzj1ykv2wllqr14k1b0cdmx-gnugrep-3.0/bin","/nix/store/8hwvdkr7i3gbkyp50lq5dpgb7fvniryv-gawk-4.1.3/bin","/nix/store/255w01kim6i6h604av7fxh63lplbldgb-gnutar-1.29/bin","/nix/store/m1z4gaqwal3gkhjz8309n2c24slr3dma-gzip-1.8/bin","/nix/store/6fc4ak60p1mnilrjfcyz0sywwmpmf45w-bzip2-1.0.6.0.1-bin/bin","/nix/store/bnjmyzdv6l0aw4xw4z2fr59qv75lbz88-gnumake-4.2.1/bin","/nix/store/fi3mbd2ml4pbgzyasrlnp0wyy6qi48fh-bash-4.4-p5/bin","/nix/store/6ygw78s2wpw8smvdrig7y05m2z1na4md-patch-2.7.5/bin","/nix/store/s2hmf51bprsxb20v3bfigs8a7zsw3hjl-xz-5.2.2-bin/bin"]


CallStack (from HasCallStack):
  error, called at src/Stack2nix.hs:195:25 in stack2nix-0.1.0.0-5CQNnxswc3zCt1pRgRw9R5:Stack2nix

The cited line corresponds to the stack list-dependencies --system-ghc call. Adding an explicit --nix to the call doesn't seem to help, and neither does removing --system-ghc. The only thing that seems to help is removing the global stack configuration setting enabling nix.

Running the following manually worked just fine, even with nix integration globally enabled. It seems PATH rewriting is happening only when stack is invoked from stack2nix.

$ git clone https://github.com/jmitchell/haskell-multi-package-demo1.git tmp
$ cd tmp
$ git checkout e3d9bd6d6066dab5222ce53fb7d234f28eafa2d5
$ stack list-dependencies --system-ghc --separator -

Happy to have narrowed in on the issue a little. It's happened sporadically, on various test machines and I've only now pinned it to the nix global integration setting in ~/.stack/config.yaml.

@domenkozar domenkozar added the bug label Jun 7, 2017
@domenkozar
Copy link
Contributor

Seems like something is using pure nix-shell resulting into git not being available.

@domenkozar
Copy link
Contributor

I've managed to reproduce.

Short term fix is

diff --git a/stack.yaml b/stack.yaml
index c623962..ccac384 100644
--- a/stack.yaml
+++ b/stack.yaml
@@ -13,4 +13,7 @@ extra-deps: []

 flags: {}

+nix:
+  packages: [git]
+
 extra-package-dbs: []

Long term fix would be for stack to include git inside the shell

@domenkozar
Copy link
Contributor

Relevant upstream issue: commercialhaskell/stack#2089

@domenkozar
Copy link
Contributor

Upstream PR: commercialhaskell/stack#3205

@domenkozar
Copy link
Contributor

Upstream has merged the PR, meanwhile you can use the workaround :)

@domenkozar domenkozar changed the title Support having nix enabled in ~/.stack/config.yaml Executable named git not found on path Jun 23, 2017
@domenkozar
Copy link
Contributor

This has been released upstream in Stack 1.5, so I'm closing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants