msteen / nix-prefetch

Prefetch any fetcher function call, e.g. a package source
MIT License
123 stars 11 forks source link

Difference in behavior between macOS and Linux #26

Open siraben opened 3 years ago

siraben commented 3 years ago

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
...
msteen commented 3 years ago

@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.

jeff-hykin commented 2 years ago

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