nixpkgs/pkgs/by-name/gi/git-get/package.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

58 lines
1.5 KiB
Nix

{
lib,
fetchFromGitHub,
buildGoModule,
}:
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; {
description = "Better way to clone, organize and manage multiple git repositories";
homepage = "https://github.com/grdl/git-get";
license = licenses.mit;
maintainers = with maintainers; [ sumnerevans ];
};
}