about summary refs log tree commit diff
path: root/pkgs/tools/text/chroma
diff options
context:
space:
mode:
authorsternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2020-11-21 15:17:44 +0100
committersternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org>2020-12-22 16:20:53 +0100
commitb3aed95a6ecec5f80cb763e4fbbaa2e2633cb49f (patch)
tree148802865b293d8194709d8cfeee502d613570d4 /pkgs/tools/text/chroma
parentfc7f72e1446b6eee70a0287cde9dbd84098e6625 (diff)
downloadnixlib-b3aed95a6ecec5f80cb763e4fbbaa2e2633cb49f.tar
nixlib-b3aed95a6ecec5f80cb763e4fbbaa2e2633cb49f.tar.gz
nixlib-b3aed95a6ecec5f80cb763e4fbbaa2e2633cb49f.tar.bz2
nixlib-b3aed95a6ecec5f80cb763e4fbbaa2e2633cb49f.tar.lz
nixlib-b3aed95a6ecec5f80cb763e4fbbaa2e2633cb49f.tar.xz
nixlib-b3aed95a6ecec5f80cb763e4fbbaa2e2633cb49f.tar.zst
nixlib-b3aed95a6ecec5f80cb763e4fbbaa2e2633cb49f.zip
chroma: 0.8.1 -> 0.8.2
Populate version information manually to avoid having to integrate
goreleaser into the build process.
Diffstat (limited to 'pkgs/tools/text/chroma')
-rw-r--r--pkgs/tools/text/chroma/default.nix24
1 files changed, 20 insertions, 4 deletions
diff --git a/pkgs/tools/text/chroma/default.nix b/pkgs/tools/text/chroma/default.nix
index 438681e1728f..390793ffaf1c 100644
--- a/pkgs/tools/text/chroma/default.nix
+++ b/pkgs/tools/text/chroma/default.nix
@@ -1,16 +1,32 @@
-{ lib, buildGoModule, fetchFromGitHub }:
+{ lib, buildGoModule, fetchFromGitHub, git }:
 
 buildGoModule rec {
   pname = "chroma";
-  version = "0.8.1";
+  version = "0.8.2";
 
   src = fetchFromGitHub {
     owner  = "alecthomas";
-    repo   = "chroma";
+    repo   = pname;
     rev    = "v${version}";
-    sha256 = "1gwwfn26aipzzvyy466gi6r54ypfy3ylnbi8c4xwch9pkgw16w98";
+    sha256 = "0vzxd0jvjaakwjvkkkjppakjb00z44k7gb5ng1i4924agh24n5ka";
+    leaveDotGit = true;
+    fetchSubmodules = true;
   };
 
+  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\""
+  '';
+
   vendorSha256 = "16cnc4scgkx8jan81ymha2q1kidm6hzsnip5mmgbxpqcc2h7hv9m";
 
   subPackages = [ "cmd/chroma" ];