2024-07-27 06:49:29 +00:00
|
|
|
{ lib, fetchFromGitHub, buildGoModule }:
|
2023-10-19 13:55:26 +00:00
|
|
|
|
|
|
|
let config-module = "git-get/pkg/cfg";
|
|
|
|
in
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "git-get";
|
|
|
|
version = "0.5.0";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "grdl";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-v98Ff7io7j1LLzciHNWJBU3LcdSr+lhwYrvON7QjyCI=";
|
|
|
|
# populate values that require us to use git. By doing this in postFetch we
|
|
|
|
# can delete .git afterwards and maintain better reproducibility of the src.
|
|
|
|
leaveDotGit = true;
|
|
|
|
postFetch = ''
|
|
|
|
git -C $out rev-parse HEAD > $out/COMMIT
|
|
|
|
# in format of 0000-00-00T00:00:00Z
|
|
|
|
date -u -d "@$(git -C $out log -1 --pretty=%ct)" "+%Y-%m-%dT%H:%M:%SZ" > $out/SOURCE_DATE_EPOCH
|
|
|
|
find "$out" -name .git -print0 | xargs -0 rm -rf
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
vendorHash = "sha256-C+XOjMDMFneKJNeBh0KWPx8yM7XiiIpTlc2daSfhZhY=";
|
|
|
|
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
# ldflags based on metadata from git and source
|
|
|
|
preBuild = ''
|
|
|
|
ldflags+=" -X ${config-module}.commit=$(cat COMMIT)"
|
|
|
|
ldflags+=" -X ${config-module}.date=$(cat SOURCE_DATE_EPOCH)"
|
|
|
|
'';
|
|
|
|
|
|
|
|
ldflags = [
|
|
|
|
"-s"
|
|
|
|
"-w"
|
|
|
|
"-X ${config-module}.version=v${version}"
|
|
|
|
];
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
mv "$GOPATH/bin/get" "$GOPATH/bin/git-get"
|
|
|
|
mv "$GOPATH/bin/list" "$GOPATH/bin/git-list"
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Better way to clone, organize and manage multiple git repositories";
|
2023-10-19 13:55:26 +00:00
|
|
|
homepage = "https://github.com/grdl/git-get";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ sumnerevans ];
|
|
|
|
};
|
|
|
|
}
|