Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 57 lines 1.5 kB view raw
1{ 2 lib, 3 fetchFromGitHub, 4 buildGoModule, 5}: 6 7let 8 config-module = "git-get/pkg/cfg"; 9in 10buildGoModule rec { 11 pname = "git-get"; 12 version = "0.5.0"; 13 14 src = fetchFromGitHub { 15 owner = "grdl"; 16 repo = "git-get"; 17 tag = "v${version}"; 18 hash = "sha256-v98Ff7io7j1LLzciHNWJBU3LcdSr+lhwYrvON7QjyCI="; 19 # populate values that require us to use git. By doing this in postFetch we 20 # can delete .git afterwards and maintain better reproducibility of the src. 21 leaveDotGit = true; 22 postFetch = '' 23 git -C $out rev-parse HEAD > $out/COMMIT 24 # in format of 0000-00-00T00:00:00Z 25 date -u -d "@$(git -C $out log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH 26 find "$out" -name .git -print0 | xargs -0 rm -rf 27 ''; 28 }; 29 30 vendorHash = "sha256-C+XOjMDMFneKJNeBh0KWPx8yM7XiiIpTlc2daSfhZhY="; 31 32 doCheck = false; 33 34 # ldflags based on metadata from git and source 35 preBuild = '' 36 ldflags+=" -X ${config-module}.commit=$(cat COMMIT)" 37 ldflags+=" -X ${config-module}.date=$(cat SOURCE_DATE_EPOCH)" 38 ''; 39 40 ldflags = [ 41 "-s" 42 "-w" 43 "-X ${config-module}.version=v${version}" 44 ]; 45 46 preInstall = '' 47 mv "$GOPATH/bin/get" "$GOPATH/bin/git-get" 48 mv "$GOPATH/bin/list" "$GOPATH/bin/git-list" 49 ''; 50 51 meta = with lib; { 52 description = "Better way to clone, organize and manage multiple git repositories"; 53 homepage = "https://github.com/grdl/git-get"; 54 license = licenses.mit; 55 maintainers = with maintainers; [ sumnerevans ]; 56 }; 57}