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

nix-prefetch-github? #21732

Closed
lukego opened this issue Jan 7, 2017 · 16 comments
Closed

nix-prefetch-github? #21732

lukego opened this issue Jan 7, 2017 · 16 comments

Comments

@lukego
Copy link
Contributor

lukego commented Jan 7, 2017

Just wondering: Is there a nix-prefetch-github command somewhere?

Imaginary example:

$ nix-prefetch-github nixos nixpkgs 16.09
{
  owner = "nixos";
  repo = "nixpkgs";
  rev = "...";
  sha256 = "...";
}

Just thinking this could be very handy for automatically generating sources lists e.g. if you want to be able to address all releases of a given project. Just to avoid the busy-work of manually translating the branch/tag to a revision id and "use a fake sha256, get real sha256 from error message, copy-paste and build again" dance.

@Mic92
Copy link
Member

Mic92 commented Jan 7, 2017

There is no such wrapper, but I would be happy to merge it.
It would be a thin shell wrapper around fetchzip. The wrapper could also implement the following targets:

  • fetchFromBitbucket
  • fetchFromGitLab
  • fetchFromSavannah

Implementation details can be looked up here:

https://github.com/NixOS/nixpkgs/blob/master/pkgs/top-level/all-packages.nix#L194

@domenkozar
Copy link
Member

Related: #21734

@zimbatm
Copy link
Member

zimbatm commented Jan 15, 2017

If it's just updating the sha256 then nix-prefetch-url -A mypackage.src can be used

@edolstra
Copy link
Member

Closing because we already have nix-prefetch-url -A.

@Mic92
Copy link
Member

Mic92 commented Jan 16, 2017

This method is not documented as far as I know.

@domenkozar domenkozar reopened this Jan 16, 2017
@domenkozar
Copy link
Member

Agreed - we should change docs at least.

@dezgeg
Copy link
Contributor

dezgeg commented Jan 16, 2017

Does nix-prefetch-url -A mypackage.src even give the right answer given that fetchFromGitHub uses fetchzip? Or is it smart enough to do same as nix-build --hash?

@domenkozar
Copy link
Member

At least two bits:

  • nix-prefetch-url -A is not documented in --help
  • prefetching nixpkgs is not easy with this method. As @lukego states we'd have to print the arguments to the fetch* function to really be iterative

@robinvd
Copy link

robinvd commented Sep 14, 2017

@domenkozar What does the -A flag do?

@domenkozar
Copy link
Member

$ nix-prefetch-url -A linuxPackages.kernel.src
 [78443/90991 KiB, 11001.6 KiB/s]g/pub/linux/kernel/v4.x/linux-4.9.49.tar.xz’... [0/0 KiB, 0.0 Ki [0/90991 KiB, 0.0 KiB/s]
path is ‘/nix/store/mbdwpv9cvyk3wfnd6mvzw0f6yklj9cgq-linux-4.9.49.tar.xz’
1ywiww2h1gf3ps305irzk7n9xkcgg9bclr2jw6r5cqxmh3qxrv2p

@domenkozar
Copy link
Member

Impure world might not have:

a) access to Nix expressions
b) ability to update Nix expressions

so nix-prefetch-url -A is not an option in those cases (like cabal2nix).

@seppeljordan
Copy link
Contributor

Hi, I wrote a little something to prefetch github sources. Check it out here: seppeljordan/nix-prefetch-github or install it from pypi.

@FRidh
Copy link
Member

FRidh commented May 28, 2018

Added in #39214.

@nrolland
Copy link

(installing via nix-env -i nix-prefetch-github)

if I nix-prefetch-github ghc ghc, what does it do exactly ?
is it like nix-prefetch-url which downloads and stores in the content addressable store ?

@pSub
Copy link
Member

pSub commented Jul 15, 2018

@nrolland From what I've seen it just downloads the source and computes the hash, but it does not add it to the nix-store.

@pSub
Copy link
Member

pSub commented Jul 15, 2018

Closing. Such a program was added in #39214.

@pSub pSub closed this as completed Jul 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests