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