2021-06-27 10:46:52 +01:00
|
|
|
{ lib, buildGoModule, fetchFromGitHub }:
|
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";
|
2020-11-21 14:17:44 +00:00
|
|
|
repo = pname;
|
2020-08-13 19:45:40 +01:00
|
|
|
rev = "v${version}";
|
2021-06-27 10:46:52 +01:00
|
|
|
sha256 = "19d7yr6q8kwrm91yyglmw9n7wa861sgi6dbwn8sl6dp55czfwvaq";
|
|
|
|
# populate values otherwise taken care of by goreleaser,
|
|
|
|
# unfortunately these require us to use git. By doing
|
|
|
|
# this in postFetch we can delete .git afterwards and
|
|
|
|
# maintain better reproducibility of the src.
|
2020-11-21 14:17:44 +00:00
|
|
|
leaveDotGit = true;
|
2021-06-27 10:46:52 +01:00
|
|
|
postFetch = ''
|
|
|
|
cd "$out"
|
2020-08-13 19:45:40 +01:00
|
|
|
|
2021-06-27 10:46:52 +01:00
|
|
|
commit="$(git rev-parse HEAD)"
|
|
|
|
date=$(git show -s --format=%aI "$commit")
|
2020-11-21 14:17:44 +00:00
|
|
|
|
2021-06-27 10:46:52 +01:00
|
|
|
substituteInPlace "$out/cmd/chroma/main.go" \
|
|
|
|
--replace 'version = "?"' 'version = "${version}"' \
|
|
|
|
--replace 'commit = "?"' "commit = \"$commit\"" \
|
|
|
|
--replace 'date = "?"' "date = \"$date\""
|
2020-11-21 14:17:44 +00:00
|
|
|
|
2021-06-27 10:46:52 +01:00
|
|
|
find "$out" -name .git -print0 | xargs -0 rm -rf
|
|
|
|
'';
|
|
|
|
};
|
2020-11-21 14:17:44 +00:00
|
|
|
|
2021-04-26 13:49:49 +01:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|