Skip to content

Commit b3aed95

Browse files
chroma: 0.8.1 -> 0.8.2
Populate version information manually to avoid having to integrate goreleaser into the build process.
1 parent fc7f72e commit b3aed95

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

pkgs/tools/text/chroma/default.nix

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,32 @@
1-
{ lib, buildGoModule, fetchFromGitHub }:
1+
{ lib, buildGoModule, fetchFromGitHub, git }:
22

33
buildGoModule rec {
44
pname = "chroma";
5-
version = "0.8.1";
5+
version = "0.8.2";
66

77
src = fetchFromGitHub {
88
owner = "alecthomas";
9-
repo = "chroma";
9+
repo = pname;
1010
rev = "v${version}";
11-
sha256 = "1gwwfn26aipzzvyy466gi6r54ypfy3ylnbi8c4xwch9pkgw16w98";
11+
sha256 = "0vzxd0jvjaakwjvkkkjppakjb00z44k7gb5ng1i4924agh24n5ka";
12+
leaveDotGit = true;
13+
fetchSubmodules = true;
1214
};
1315

16+
nativeBuildInputs = [ git ];
17+
18+
# populate values otherwise taken care of by goreleaser
19+
# https://github.com/alecthomas/chroma/issues/435
20+
postPatch = ''
21+
commit="$(git rev-parse HEAD)"
22+
date=$(git show -s --format=%aI "$commit")
23+
24+
substituteInPlace cmd/chroma/main.go \
25+
--replace 'version = "?"' 'version = "${version}"' \
26+
--replace 'commit = "?"' "commit = \"$commit\"" \
27+
--replace 'date = "?"' "date = \"$date\""
28+
'';
29+
1430
vendorSha256 = "16cnc4scgkx8jan81ymha2q1kidm6hzsnip5mmgbxpqcc2h7hv9m";
1531

1632
subPackages = [ "cmd/chroma" ];

0 commit comments

Comments
 (0)