1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 stdenv,
7}:
8
9buildGoModule rec {
10 pname = "glow";
11 version = "2.1.1";
12
13 src = fetchFromGitHub {
14 owner = "charmbracelet";
15 repo = "glow";
16 rev = "v${version}";
17 hash = "sha256-lDGCRtwCpW/bZlfcb100g7tMXN2dlCPnCY7qVFyayUo=";
18 };
19
20 vendorHash = "sha256-JqQnLwkxRt+CiP90F+1i4MAiOw3akMQ5BeQXCplZdxA=";
21
22 nativeBuildInputs = [ installShellFiles ];
23
24 ldflags = [
25 "-s"
26 "-w"
27 "-X=main.Version=${version}"
28 ];
29
30 doCheck = false;
31
32 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
33 installShellCompletion --cmd glow \
34 --bash <($out/bin/glow completion bash) \
35 --fish <($out/bin/glow completion fish) \
36 --zsh <($out/bin/glow completion zsh)
37 '';
38
39 meta = {
40 description = "Render markdown on the CLI, with pizzazz";
41 homepage = "https://github.com/charmbracelet/glow";
42 changelog = "https://github.com/charmbracelet/glow/releases/tag/v${version}";
43 license = lib.licenses.mit;
44 maintainers = with lib.maintainers; [
45 Br1ght0ne
46 penguwin
47 ];
48 mainProgram = "glow";
49 };
50}