2020-11-21 15:17:44 +01:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub, git }:
|
2020-08-13 20:45:40 +02:00
|
|
|
|
|
|
|
buildGoModule rec {
|
|
|
|
pname = "chroma";
|
2021-04-26 14:49:49 +02:00
|
|
|
version = "0.9.1";
|
2020-08-13 20:45:40 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "alecthomas";
|
2020-11-21 15:17:44 +01:00
|
|
|
repo = pname;
|
2020-08-13 20:45:40 +02:00
|
|
|
rev = "v${version}";
|
2021-05-09 03:41:04 +02:00
|
|
|
sha256 = "sha256-+4UaQrJh3PBf68rlW1lOEyEVw3vWxfc+Casa5+H8F9A=";
|
2020-11-21 15:17:44 +01:00
|
|
|
leaveDotGit = true;
|
2020-08-13 20:45:40 +02:00
|
|
|
};
|
|
|
|
|
2020-11-21 15:17:44 +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\""
|
|
|
|
'';
|
|
|
|
|
2021-04-26 14:49:49 +02:00
|
|
|
vendorSha256 = "0y8mp08zccn9qxrsj9j7vambz8dwzsxbbgrlppzam53rg8rpxhrg";
|
2020-08-13 20:45:40 +02: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 ];
|
|
|
|
};
|
|
|
|
}
|