[Nix-dev] Pulling a programs source code from a git repo

Eelco Dolstra eelco.dolstra at logicblox.com
Sun Jan 26 14:05:41 CET 2014


Hi,

On 25/01/14 03:20, Liam Daly wrote:

> Is it possible to pull a programs source code from a git repo?

"fetchgit" is your friend, e.g.:

  src = fetchgit {
    url = "git://alioth.debian.org/git/sane/sane-backends.git";
    rev = "6c4f6bc58615755dc734281703b594cea3ebf848";
    sha256 = "0f7lbv1rnr53n4rpihcd8dkfm01xvwfnx9i1nqaadrzbpvgkjrfa";
  };

You can get the SHA-256 hash using the nix-prefetch-git utility in Nixpkgs (or
just fill in a random hash, run nix-build and let Nix tell you the actual hash).

You cannot get the HEAD revision though - you need to fetch a specific revision
(otherwise the build wouldn't be deterministic).

-- 
Eelco Dolstra | LogicBlox, Inc. | http://nixos.org/~eelco/


More information about the nix-dev mailing list