input-output-hk / haskell.nix

Alternative Haskell Infrastructure for Nixpkgs
https://input-output-hk.github.io/haskell.nix
Apache License 2.0
549 stars 237 forks source link

Private source-repository-packages over ssh do not work ("error: cannot run ssh: No such file or directory") #1996

Open ramirez7 opened 1 year ago

ramirez7 commented 1 year ago

This template is a guide only, feel free add or omit sections as appropriate.

Describe the bug

A clear and concise description of what the bug is, including:

source-repository-package
    type: git
    location: ssh://gitlab.com/macaroni.dev/mayhem-engine.git
    tag: d5b6f455b83f8fe5891f2b49046e45ee6869600e
    --sha256: sha256-2UbpA9U/RtSOX1WKMKrmPHyB6sIiGqhwoPTX1TC0O99=
exporting ssh://gitlab.com/macaroni.dev/mayhem-engine.git (rev d5b6f455b83f8fe5891f2b49046e45ee6869600e) into /nix/store/m4hly5b1k8fgb3k1hmiyavqlcv4p48dj-mayhem-engine-d5b6f45
Initialized empty Git repository in /nix/store/m4hly5b1k8fgb3k1hmiyavqlcv4p48dj-mayhem-engine-d5b6f45/.git/
error: cannot run ssh: No such file or directory
fatal: unable to fork
error: cannot run ssh: No such file or directory
fatal: unable to fork
error: cannot run ssh: No such file or directory
fatal: unable to fork
Unable to checkout d5b6f455b83f8fe5891f2b49046e45ee6869600e from ssh://gitlab.com/macaroni.dev/mayhem-engine.git.

Steps To Reproduce

Add a private repository with an ssh:// url

Expected behavior

For private repositories to be accessible via ssh

Additional context

n/a

andreabedini commented 1 year ago

Are you running this inside nix? if so it is not a cabal bug but it might be a problem with your nix setup.

RichardWarfield commented 11 months ago

At least for Github, this works for me with git+ssh://git@github.com/owner/repo.git syntax

ramirez7 commented 11 months ago

@RichardWarfield I'll try that next chance I get! Thanks

andreabedini commented 11 months ago

@ramirez7 Are you sure your steps to reproduce are complete?

exporting ssh://gitlab.com/macaroni.dev/mayhem-engine.git (rev d5b6f455b83f8fe5891f2b49046e45ee6869600e) into /nix/store/m4hly5b1k8fgb3k1hmiyavqlcv4p48dj-mayhem-engine-d5b6f45

does not seem a message from cabal, maybe it is from haskell.nix?

Trying to reproduce, I get the following

❯ cat cabal.project
source-repository-package
    type: git
    location: ssh://gitlab.com/macaroni.dev/mayhem-engine.git
    tag: d5b6f455b83f8fe5891f2b49046e45ee6869600e
❯ cabal build -v3 --dry-run
...
Running: /home/andrea/.nix-profile/bin/git clone --no-checkout 'ssh://gitlab.com/macaroni.dev/mayhem-engine.git' /home/andrea/Scratchpad/temp/dist-newstyle/src/mayhem-en_-71d60d8a39d7eacd
with environment: [...]
Cloning into '/home/andrea/Scratchpad/temp/dist-newstyle/src/mayhem-en_-71d60d8a39d7eacd'...
andrea@gitlab.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Which is very different from what you report above.

johannwagner commented 9 months ago

I ran into the same issue. It might be related to NixOS and/or single- and multi-user installations, if this works fine or not, absolutly no clue.

We have to use nix-prefetch-git to get those dependencies. After a nix-prefetch-git https://myrepository.git hash everything works like it is supposed to.

sebastiant commented 7 months ago

Thanks for that @johannwagner I tried saving myself a couple of seconds by running nix-prefetch-git with HEAD but that gets stored in a different place in the nix store and so does not work as a work-around. Thought i'd share that in case anyone else got stuck with doing that

stale[bot] commented 3 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.