summaryrefslogtreecommitdiff
path: root/pkgs/by-name/go/go-blueprint/package.nix
blob: 87019c44fe02c17081bd9ebf4beacf5b63e716a8 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
{
  lib,
  buildGoModule,
  fetchFromGitHub,
  installShellFiles,
  versionCheckHook,
  stdenv,
}:

buildGoModule rec {
  pname = "go-blueprint";
  version = "0.10.5";

  src = fetchFromGitHub {
    owner = "Melkeydev";
    repo = "go-blueprint";
    rev = "v${version}";
    hash = "sha256-8J+PxFHrNkX2McBn1tO7Q1X4tWtMWDIRsxzKtRhM/Jk=";
  };

  ldflags = [
    "-s -w -X github.com/melkeydev/go-blueprint/cmd.GoBlueprintVersion=v${version}"
  ];

  vendorHash = "sha256-WBzToupC1/O70OYHbKk7S73OEe7XRLAAbY5NoLL7xvw=";

  nativeBuildInputs = [ installShellFiles ];
  nativeInstallCheckInputs = [
    versionCheckHook
  ];
  doInstallCheck = true;
  versionCheckProgramArg = "version";

  postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
    installShellCompletion --cmd go-blueprint \
      --bash <($out/bin/go-blueprint completion bash) \
      --fish <($out/bin/go-blueprint completion fish) \
      --zsh <($out/bin/go-blueprint completion zsh)
  '';

  meta = {
    description = "Initialize Go projects using popular frameworks";
    homepage = "https://github.com/Melkeydev/go-blueprint";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ tobifroe ];
    mainProgram = "go-blueprint";
  };
}