nixpkgs/pkgs/tools/text/chroma/default.nix
sternenseemann 22a15615c7 chroma: 0.9.2 -> 0.9.4
cmd/chroma is no longer a sub package, but its own module which we need
to account for.
2021-11-03 10:40:23 +01:00

44 lines
1.2 KiB
Nix

{ lib, buildGoModule, fetchFromGitHub }:
buildGoModule rec {
pname = "chroma";
version = "0.9.4";
src = fetchFromGitHub {
owner = "alecthomas";
repo = pname;
rev = "v${version}";
sha256 = "14jp6f83ca2srcylf9w6v7cvznrm1sbpcs6lk7pimgr3jhy5j339";
# 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.
leaveDotGit = true;
postFetch = ''
cd "$out"
commit="$(git rev-parse HEAD)"
date=$(git show -s --format=%aI "$commit")
substituteInPlace "$out/cmd/chroma/main.go" \
--replace 'version = "?"' 'version = "${version}"' \
--replace 'commit = "?"' "commit = \"$commit\"" \
--replace 'date = "?"' "date = \"$date\""
find "$out" -name .git -print0 | xargs -0 rm -rf
'';
};
vendorSha256 = "1l5ryhwifhff41r4z1d2lifpvjcc4yi1vzrzlvkx3iy9dmxqcssl";
modRoot = "./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 ];
};
}