nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 testers,
5 buildGoModule,
6 fetchFromGitHub,
7 installShellFiles,
8 container-structure-test,
9}:
10buildGoModule rec {
11 version = "1.22.1";
12 pname = "container-structure-test";
13 src = fetchFromGitHub {
14 owner = "GoogleContainerTools";
15 repo = "container-structure-test";
16 rev = "v${version}";
17 sha256 = "sha256-iNJH5mrDRlwS4qry0OyT/MRlGjHbKjWZbppkbTX6ksI=";
18 };
19 vendorHash = "sha256-pBq76HJ+nluOMOs9nqBKp1mr1LuX2NERXo48g8ezE9k=";
20
21 subPackages = [ "cmd/container-structure-test" ];
22 ldflags = [
23 "-X github.com/${src.owner}/${src.repo}/pkg/version.version=${version}"
24 "-X github.com/${src.owner}/${src.repo}/pkg/version.buildDate=1970-01-01T00:00:00Z"
25 ];
26
27 nativeBuildInputs = [ installShellFiles ];
28 postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
29 for shell in bash fish zsh; do
30 $out/bin/container-structure-test completion $shell > executor.$shell
31 installShellCompletion executor.$shell
32 done
33 '';
34
35 passthru.tests.version = testers.testVersion {
36 package = container-structure-test;
37 version = version;
38 command = "${lib.getExe container-structure-test} version";
39 };
40
41 meta = {
42 homepage = "https://github.com/GoogleContainerTools/container-structure-test";
43 description = "Framework to validate the structure of a container image";
44 license = lib.licenses.asl20;
45 maintainers = with lib.maintainers; [ rubenhoenle ];
46 platforms = lib.platforms.darwin ++ lib.platforms.linux;
47 mainProgram = "container-structure-test";
48 sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ];
49 };
50}