1{
2 lib,
3 stdenv,
4 buildGoModule,
5 fetchFromGitHub,
6 go-md2man,
7 installShellFiles,
8 pkg-config,
9 gpgme,
10 lvm2,
11 btrfs-progs,
12 libapparmor,
13 libselinux,
14 libseccomp,
15 testers,
16 buildah,
17}:
18
19buildGoModule rec {
20 pname = "buildah";
21 version = "1.40.0";
22
23 src = fetchFromGitHub {
24 owner = "containers";
25 repo = "buildah";
26 rev = "v${version}";
27 hash = "sha256-4gn8bbzI+NerU8Bdi6FxLB/Kg1JaDBiZkR98zMRvTkw=";
28 };
29
30 outputs = [
31 "out"
32 "man"
33 ];
34
35 vendorHash = null;
36
37 doCheck = false;
38
39 # /nix/store/.../bin/ld: internal/mkcw/embed/entrypoint_amd64.o: relocation R_X86_64_32S against `.rodata.1' can not be used when making a PIE object; recompile with -fPIE
40 hardeningDisable = [ "pie" ];
41
42 nativeBuildInputs = [
43 go-md2man
44 installShellFiles
45 pkg-config
46 ];
47
48 buildInputs =
49 [
50 gpgme
51 ]
52 ++ lib.optionals stdenv.hostPlatform.isLinux [
53 btrfs-progs
54 libapparmor
55 libseccomp
56 libselinux
57 lvm2
58 ];
59
60 buildPhase = ''
61 runHook preBuild
62 patchShebangs .
63 make bin/buildah
64 make -C docs GOMD2MAN="go-md2man"
65 runHook postBuild
66 '';
67
68 installPhase = ''
69 runHook preInstall
70 install -Dm755 bin/buildah $out/bin/buildah
71 installShellCompletion --bash contrib/completions/bash/buildah
72 make -C docs install PREFIX="$man"
73 runHook postInstall
74 '';
75
76 passthru.tests.version = testers.testVersion {
77 package = buildah;
78 command = ''
79 XDG_DATA_HOME="$TMPDIR" XDG_CACHE_HOME="$TMPDIR" XDG_CONFIG_HOME="$TMPDIR" \
80 buildah --version
81 '';
82 };
83
84 meta = with lib; {
85 description = "Tool which facilitates building OCI images";
86 mainProgram = "buildah";
87 homepage = "https://buildah.io/";
88 changelog = "https://github.com/containers/buildah/releases/tag/v${version}";
89 license = licenses.asl20;
90 teams = [ teams.podman ];
91 };
92}