nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 installShellFiles,
7 nix-update-script,
8 versionCheckHook,
9}:
10
11buildGoModule (finalAttrs: {
12 pname = "go-task";
13 version = "3.45.5";
14
15 src = fetchFromGitHub {
16 owner = "go-task";
17 repo = "task";
18 tag = "v${finalAttrs.version}";
19 hash = "sha256-YIsFADsGDgBR8TYrvhyz1DR1q6wZXDhjSsWi8DeijFA=";
20 };
21
22 vendorHash = "sha256-DQqz/GwV8SIsQsyF39Rzw+ojzhVw6Ih2j5utILEomV4=";
23
24 nativeBuildInputs = [ installShellFiles ];
25
26 subPackages = [ "cmd/task" ];
27
28 ldflags = [
29 "-s"
30 "-w"
31 "-X=github.com/go-task/task/v3/internal/version.version=${finalAttrs.version}"
32 ];
33
34 env.CGO_ENABLED = 0;
35
36 postInstall = ''
37 ln -s $out/bin/task $out/bin/go-task
38 ''
39 + lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
40 installShellCompletion --cmd task \
41 --bash <($out/bin/task --completion bash) \
42 --fish <($out/bin/task --completion fish) \
43 --zsh <($out/bin/task --completion zsh)
44 '';
45
46 nativeInstallCheckInputs = [
47 versionCheckHook
48 ];
49 doInstallCheck = true;
50 versionCheckProgram = "${placeholder "out"}/bin/task";
51
52 passthru.updateScript = nix-update-script { };
53
54 meta = {
55 homepage = "https://taskfile.dev/";
56 description = "Task runner / simpler Make alternative written in Go";
57 changelog = "https://github.com/go-task/task/blob/v${finalAttrs.version}/CHANGELOG.md";
58 license = lib.licenses.mit;
59 maintainers = with lib.maintainers; [ parasrah ];
60 };
61})