nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 installShellFiles,
7 testers,
8 datree,
9}:
10
11buildGoModule rec {
12 pname = "datree";
13 version = "1.9.19";
14
15 src = fetchFromGitHub {
16 owner = "datreeio";
17 repo = "datree";
18 tag = version;
19 hash = "sha256-W1eX7eUMdPGbHA/f08xkG2EUeZmaunEAQn7/LRBe2nk=";
20 };
21
22 vendorHash = "sha256-+PQhuIO4KjXtW/ZcS0OamuOHzK7ZL+nwOBxeCRoXuKE=";
23
24 nativeBuildInputs = [ installShellFiles ];
25
26 ldflags = [
27 "-s"
28 "-w"
29 "-X github.com/datreeio/datree/cmd.CliVersion=${version}"
30 ];
31
32 tags = [ "main" ];
33
34 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
35 installShellCompletion \
36 --cmd datree \
37 --bash <($out/bin/datree completion bash) \
38 --fish <($out/bin/datree completion fish) \
39 --zsh <($out/bin/datree completion zsh)
40 '';
41
42 passthru.tests.version = testers.testVersion {
43 package = datree;
44 command = "datree version";
45 };
46
47 meta = {
48 description = "CLI tool to ensure K8s manifests and Helm charts follow best practices";
49 mainProgram = "datree";
50 longDescription = ''
51 Datree provides an E2E policy enforcement solution to run automatic checks
52 for rule violations. Datree can be used on the command line, admission
53 webhook, or even as a kubectl plugin to run policies against Kubernetes
54 objects.
55 '';
56 homepage = "https://datree.io/";
57 changelog = "https://github.com/datreeio/datree/releases/tag/${version}";
58 license = lib.licenses.asl20;
59 maintainers = with lib.maintainers; [
60 azahi
61 jceb
62 ];
63 };
64}