nix-community / nurl

Generate Nix fetcher calls from repository URLs [maintainer=@figsoda]
https://discourse.nixos.org/t/24374
Mozilla Public License 2.0
462 stars 7 forks source link

Github: support private repository #337

Open OlivierLDff opened 5 months ago

OlivierLDff commented 5 months ago

Trying to use nurl on a private repository, I get an error:

HTTP error 404

       response body:

       {
         "message": "Not Found",
         "documentation_url": "https://docs.github.com/rest/commits/commits#get-a-commit"
       }
Error: command exited with exit status: 1

I see in the source code that no token are set. Would it be possible to read optional token from env variable for example GITHUB_TOKEN. Or to be able to specify it via CLI, for example via --token?

For those interested, my current workaround it to use (this is based on some comments I found in a github issue, but I forgot to write down the author name, I adapted it to fix the deprecation warning):

nix-shell -p nix-prefetch-git jq --run "nix hash convert --hash-algo sha256 --to sri \$(nix-prefetch-git --url https://github.com/USER/REPO --quiet --rev TAG | jq -r '.sha256')"

Of course this just gives me the sha256, which is just what I need for now.

Have a nice day.

brizzbuzz commented 2 months ago

ideally support via ssh as well instead of relying on GitHub api 😇