nix-prefetch icon indicating copy to clipboard operation
nix-prefetch copied to clipboard

Difference in behavior between macOS and Linux

Open siraben opened this issue 2 years ago • 2 comments

As of release 0.4.1, I observe the following behavior.

$ uname -ris
Darwin 19.6.0 MacBookPro11,1
$ nix-prefetch fetchFromGitHub --help
error: Unsupported input type ''.
$ uname -ris
Linux 3.10.0-862.14.4.el7.x86_64 x86_64
$ nix-prefetch fetchFromGitHub --help
Prefetch the fetchFromGitHub function call

Usage:
  nix-prefetch fetchFromGitHub
...

siraben avatar Jul 24 '21 04:07 siraben

@siraben With regards to macOS, I had people report it now working under macOS with version 0.4.1, must be some difference between macOS versions? Either way, I simplified the regex further and just check for empty beforehand, that should work, or else there are plenty of other locations it should have failed under macOS already.

I could not quite reproduce your problems under Linux. If you see the diff for 0.4.1, it is clear this cannot have brought upon those changes you see. I have verified this myself, my desktop running a very recent NixOS indeed now gives different output (different from yours, but still not correctly like in the past), while my server with an older NixOS yet running the very latest nix-prefetch, will give the correct output. To address it properly is better left to the rewrite I am slowly working on.

msteen avatar Jul 24 '21 08:07 msteen

It seems to be because the native shell is being used instead of a nix-pinned verison.

Cloning the repo and replacing all four of the

#! /usr/bin/env bash

With

#! /usr/bin/env nix-shell
#! nix-shell -i bash -p bash_5 -I nixpkgs=https://github.com/NixOS/nixpkgs/archive/7e9b0dff974c89e070da1ad85713ff3c20b0ca97.tar.gz

seems to work for me

jeff-hykin avatar Feb 28 '22 14:02 jeff-hykin