2020-12-25 13:55:36 +00:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, git }:
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "chroma";
|
2020-12-25 13:55:36 +00:00
|
|
|
version = "0.8.2";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "alecthomas";
|
2020-12-25 13:55:36 +00:00
|
|
|
repo = pname;
|
2020-09-25 04:45:31 +00:00
|
|
|
rev = "v${version}";
|
2020-12-25 13:55:36 +00:00
|
|
|
sha256 = "0vzxd0jvjaakwjvkkkjppakjb00z44k7gb5ng1i4924agh24n5ka";
|
|
|
|
leaveDotGit = true;
|
|
|
|
fetchSubmodules = true;
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2020-12-25 13:55:36 +00: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\""
|
|
|
|
'';
|
|
|
|
|
2020-09-25 04:45:31 +00:00
|
|
|
vendorSha256 = "16cnc4scgkx8jan81ymha2q1kidm6hzsnip5mmgbxpqcc2h7hv9m";
|
|
|
|
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|