2021-04-22 02:08:21 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, pkg-config
|
|
|
|
, installShellFiles
|
2020-05-15 21:57:56 +00:00
|
|
|
, buildGoModule
|
2020-04-24 23:36:52 +00:00
|
|
|
, gpgme
|
|
|
|
, lvm2
|
|
|
|
, btrfs-progs
|
2020-05-15 21:57:56 +00:00
|
|
|
, libapparmor
|
2020-04-24 23:36:52 +00:00
|
|
|
, libseccomp
|
2020-05-15 21:57:56 +00:00
|
|
|
, libselinux
|
2020-04-24 23:36:52 +00:00
|
|
|
, systemd
|
|
|
|
, go-md2man
|
|
|
|
, nixosTests
|
2022-10-21 18:38:19 +00:00
|
|
|
, python3
|
2023-03-04 12:14:45 +00:00
|
|
|
, makeWrapper
|
|
|
|
, symlinkJoin
|
|
|
|
, extraPackages ? [ ]
|
|
|
|
, runc
|
|
|
|
, crun
|
|
|
|
, conmon
|
|
|
|
, slirp4netns
|
|
|
|
, fuse-overlayfs
|
|
|
|
, util-linux
|
|
|
|
, iptables
|
|
|
|
, iproute2
|
|
|
|
, catatonit
|
|
|
|
, gvproxy
|
|
|
|
, aardvark-dns
|
|
|
|
, netavark
|
2023-02-16 17:41:37 +00:00
|
|
|
, testers
|
|
|
|
, podman
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
2023-03-04 12:14:45 +00:00
|
|
|
let
|
|
|
|
# do not add qemu to this wrapper, store paths get written to the podman vm config and break when GCed
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
binPath = lib.makeBinPath ([
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
runc
|
|
|
|
crun
|
|
|
|
conmon
|
|
|
|
slirp4netns
|
|
|
|
fuse-overlayfs
|
|
|
|
util-linux
|
|
|
|
iptables
|
|
|
|
iproute2
|
|
|
|
] ++ extraPackages);
|
|
|
|
|
|
|
|
helpersBin = symlinkJoin {
|
|
|
|
name = "podman-helper-binary-wrapper";
|
|
|
|
|
|
|
|
# this only works for some binaries, others may need to be be added to `binPath` or in the modules
|
|
|
|
paths = [
|
|
|
|
gvproxy
|
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
aardvark-dns
|
|
|
|
catatonit # added here for the pause image and also set in `containersConf` for `init_path`
|
|
|
|
netavark
|
|
|
|
];
|
|
|
|
};
|
|
|
|
in
|
2020-05-15 21:57:56 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "podman";
|
2023-03-04 12:14:45 +00:00
|
|
|
version = "4.4.2";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "containers";
|
2020-07-18 16:06:22 +00:00
|
|
|
repo = "podman";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "v${version}";
|
2023-03-04 12:14:45 +00:00
|
|
|
hash = "sha256-337PFsPGm7pUgnFeNJKwT+/7AdbWSfCx4kXyAvHyWJQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
patches = [
|
|
|
|
# we intentionally don't build and install the helper so we shouldn't display messages to users about it
|
|
|
|
./rm-podman-mac-helper-msg.patch
|
|
|
|
];
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
vendorHash = null;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2020-08-20 17:08:02 +00:00
|
|
|
doCheck = false;
|
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
outputs = [ "out" "man" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
nativeBuildInputs = [ pkg-config go-md2man installShellFiles makeWrapper python3 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isLinux [
|
2020-05-15 21:57:56 +00:00
|
|
|
btrfs-progs
|
|
|
|
gpgme
|
|
|
|
libapparmor
|
|
|
|
libseccomp
|
|
|
|
libselinux
|
|
|
|
lvm2
|
|
|
|
systemd
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-03-04 12:14:45 +00:00
|
|
|
HELPER_BINARIES_DIR = "${PREFIX}/libexec/podman"; # used in buildPhase & installPhase
|
|
|
|
PREFIX = "${placeholder "out"}";
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
buildPhase = ''
|
2021-04-05 15:23:46 +00:00
|
|
|
runHook preBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
patchShebangs .
|
2022-03-05 16:20:37 +00:00
|
|
|
${if stdenv.isDarwin then ''
|
|
|
|
make podman-remote # podman-mac-helper uses FHS paths
|
|
|
|
'' else ''
|
2023-03-04 12:14:45 +00:00
|
|
|
make bin/podman bin/rootlessport bin/quadlet
|
2022-03-05 16:20:37 +00:00
|
|
|
''}
|
2020-07-18 16:06:22 +00:00
|
|
|
make docs
|
2021-04-05 15:23:46 +00:00
|
|
|
runHook postBuild
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-04-05 15:23:46 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2022-03-05 16:20:37 +00:00
|
|
|
${if stdenv.isDarwin then ''
|
2023-03-04 12:14:45 +00:00
|
|
|
install bin/darwin/podman -Dt $out/bin
|
2022-03-05 16:20:37 +00:00
|
|
|
'' else ''
|
2023-03-04 12:14:45 +00:00
|
|
|
make install.bin install.systemd
|
2022-03-05 16:20:37 +00:00
|
|
|
''}
|
2023-03-04 12:14:45 +00:00
|
|
|
make install.completions install.man
|
|
|
|
mkdir -p ${HELPER_BINARIES_DIR}
|
|
|
|
ln -s ${helpersBin}/bin/* ${HELPER_BINARIES_DIR}
|
|
|
|
wrapProgram $out/bin/podman \
|
|
|
|
--prefix PATH : ${lib.escapeShellArg binPath}
|
2021-04-05 15:23:46 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-06-01 10:57:12 +00:00
|
|
|
postFixup = lib.optionalString stdenv.isLinux ''
|
2023-03-04 12:14:45 +00:00
|
|
|
RPATH=$(patchelf --print-rpath $out/bin/.podman-wrapped)
|
|
|
|
patchelf --set-rpath "${lib.makeLibraryPath [ systemd ]}":$RPATH $out/bin/.podman-wrapped
|
2021-06-01 10:57:12 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
passthru.tests = {
|
2023-02-16 17:41:37 +00:00
|
|
|
version = testers.testVersion {
|
|
|
|
package = podman;
|
|
|
|
command = "HOME=$TMPDIR podman --version";
|
|
|
|
};
|
|
|
|
} // lib.optionalAttrs stdenv.isLinux {
|
2021-06-01 10:57:12 +00:00
|
|
|
inherit (nixosTests) podman;
|
|
|
|
# related modules
|
2021-06-04 09:07:49 +00:00
|
|
|
inherit (nixosTests)
|
|
|
|
podman-tls-ghostunnel
|
|
|
|
;
|
2022-04-27 09:35:20 +00:00
|
|
|
oci-containers-podman = nixosTests.oci-containers.podman;
|
2021-06-01 10:57:12 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://podman.io/";
|
|
|
|
description = "A program for managing pods, containers and container images";
|
2022-03-05 16:20:37 +00:00
|
|
|
changelog = "https://github.com/containers/podman/blob/v${version}/RELEASE_NOTES.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ marsam ] ++ teams.podman.members;
|
|
|
|
};
|
|
|
|
}
|