1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 testers,
7 fioctl,
8}:
9
10buildGoModule rec {
11 pname = "fioctl";
12 version = "0.43";
13
14 src = fetchFromGitHub {
15 owner = "foundriesio";
16 repo = "fioctl";
17 rev = "v${version}";
18 sha256 = "sha256-hZ8jkIbNY2z4M7sHCYq6vVacetThcoYPJjkr8PFQmQA=";
19 };
20
21 vendorHash = "sha256-SUjHHsZGi5C5juYdJJ0Z7i6P6gySQOdn1VaReCIwfzU=";
22
23 ldflags = [
24 "-s"
25 "-w"
26 "-X github.com/foundriesio/fioctl/subcommands/version.Commit=${src.rev}"
27 ];
28
29 nativeBuildInputs = [ installShellFiles ];
30
31 postInstall = ''
32 installShellCompletion --cmd fioctl \
33 --bash <($out/bin/fioctl completion bash) \
34 --fish <($out/bin/fioctl completion fish) \
35 --zsh <($out/bin/fioctl completion zsh)
36 '';
37
38 passthru.tests.version = testers.testVersion {
39 package = fioctl;
40 command = "HOME=$(mktemp -d) fioctl version";
41 version = "v${version}";
42 };
43
44 meta = with lib; {
45 description = "Simple CLI to manage your Foundries Factory";
46 homepage = "https://github.com/foundriesio/fioctl";
47 license = licenses.asl20;
48 maintainers = with maintainers; [
49 nixinator
50 matthewcroughan
51 ];
52 mainProgram = "fioctl";
53 };
54}