nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6}:
7
8buildGoModule rec {
9 pname = "driftctl";
10 version = "0.40.0";
11
12 src = fetchFromGitHub {
13 owner = "snyk";
14 repo = "driftctl";
15 rev = "v${version}";
16 sha256 = "sha256-IDKfW0NCEsgKXpHA7SwkHjMeoGAIYITlDVR/vI/b9hk=";
17 };
18
19 vendorHash = "sha256-JFvC9PReziktHSXbltGkGHjVR8hTM1hPJ0OqrZQXRQM=";
20
21 nativeBuildInputs = [ installShellFiles ];
22
23 ldflags = [
24 "-s"
25 "-w"
26 "-X github.com/snyk/driftctl/pkg/version.version=v${version}"
27 "-X github.com/snyk/driftctl/build.env=release"
28 "-X github.com/snyk/driftctl/build.enableUsageReporting=false"
29 ];
30
31 postInstall = ''
32 installShellCompletion --cmd driftctl \
33 --bash <($out/bin/driftctl completion bash) \
34 --fish <($out/bin/driftctl completion fish) \
35 --zsh <($out/bin/driftctl completion zsh)
36 '';
37
38 doInstallCheck = true;
39 installCheckPhase = ''
40 runHook preInstallCheck
41
42 $out/bin/driftctl --help
43 $out/bin/driftctl version | grep "v${version}"
44 # check there's no telemetry flag
45 $out/bin/driftctl --help | grep -vz "telemetry"
46
47 runHook postInstallCheck
48 '';
49
50 meta = {
51 homepage = "https://driftctl.com/";
52 changelog = "https://github.com/snyk/driftctl/releases/tag/v${version}";
53 description = "Detect, track and alert on infrastructure drift";
54 mainProgram = "driftctl";
55 longDescription = ''
56 driftctl is a free and open-source CLI that warns of infrastructure drift
57 and fills in the missing piece in your DevSecOps toolbox.
58 '';
59 license = lib.licenses.asl20;
60 maintainers = with lib.maintainers; [
61 kaction
62 jk
63 qjoly
64 ];
65 };
66}