nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 nixosTests,
6}:
7
8buildGoModule rec {
9 pname = "cadvisor";
10 version = "0.56.2";
11
12 src = fetchFromGitHub {
13 owner = "google";
14 repo = "cadvisor";
15 rev = "v${version}";
16 hash = "sha256-UBQvFlO0pb5mDUrrUTaEsuQcKX7qKQrAMub2knUZWGA=";
17 };
18
19 modRoot = "./cmd";
20
21 vendorHash = "sha256-JJulf+Wj/bf3l8l0rufcyLlfqefriOzhxCfGUru6+lA=";
22
23 ldflags = [
24 "-s"
25 "-w"
26 "-X github.com/google/cadvisor/version.Version=${version}"
27 ];
28
29 postInstall = ''
30 mv $out/bin/{cmd,cadvisor}
31 rm $out/bin/example
32 '';
33
34 passthru.tests = { inherit (nixosTests) cadvisor; };
35
36 meta = {
37 description = "Analyzes resource usage and performance characteristics of running docker containers";
38 mainProgram = "cadvisor";
39 homepage = "https://github.com/google/cadvisor";
40 license = lib.licenses.asl20;
41 maintainers = with lib.maintainers; [ offline ];
42 platforms = lib.platforms.linux;
43 };
44}