3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/tools/text/chroma/default.nix

40 lines
1.1 KiB
Nix
Raw Normal View History

{ lib, buildGoModule, fetchFromGitHub, git }:
2020-08-13 19:45:40 +01:00
buildGoModule rec {
pname = "chroma";
2021-06-27 10:37:48 +01:00
version = "0.9.2";
2020-08-13 19:45:40 +01:00
src = fetchFromGitHub {
owner = "alecthomas";
repo = pname;
2020-08-13 19:45:40 +01:00
rev = "v${version}";
2021-06-27 10:37:48 +01:00
sha256 = "0g5l961sr05p0kfj56qcxs9f4x3ji3p6n96zrc16cij5ncncasxw";
leaveDotGit = true;
2020-08-13 19:45:40 +01:00
};
nativeBuildInputs = [ git ];
# populate values otherwise taken care of by goreleaser
# https://github.com/alecthomas/chroma/issues/435
postPatch = ''
commit="$(git rev-parse HEAD)"
date=$(git show -s --format=%aI "$commit")
substituteInPlace cmd/chroma/main.go \
--replace 'version = "?"' 'version = "${version}"' \
--replace 'commit = "?"' "commit = \"$commit\"" \
--replace 'date = "?"' "date = \"$date\""
'';
vendorSha256 = "0y8mp08zccn9qxrsj9j7vambz8dwzsxbbgrlppzam53rg8rpxhrg";
2020-08-13 19:45:40 +01:00
subPackages = [ "cmd/chroma" ];
meta = with lib; {
homepage = "https://github.com/alecthomas/chroma";
description = "A general purpose syntax highlighter in pure Go";
license = licenses.mit;
maintainers = [ maintainers.sternenseemann ];
};
}