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
|
2023-04-29 16:46:19 +00:00
|
|
|
, runtimeShell
|
2023-03-04 12:14:45 +00:00
|
|
|
, symlinkJoin
|
2024-04-21 15:54:59 +00:00
|
|
|
, substituteAll
|
2023-03-04 12:14:45 +00:00
|
|
|
, extraPackages ? [ ]
|
|
|
|
, runc
|
|
|
|
, crun
|
2024-04-21 15:54:59 +00:00
|
|
|
, gvisor
|
|
|
|
, youki
|
2023-03-04 12:14:45 +00:00
|
|
|
, conmon
|
|
|
|
, slirp4netns
|
|
|
|
, fuse-overlayfs
|
|
|
|
, util-linux
|
|
|
|
, iptables
|
|
|
|
, iproute2
|
|
|
|
, catatonit
|
|
|
|
, gvproxy
|
|
|
|
, aardvark-dns
|
|
|
|
, netavark
|
2024-04-21 15:54:59 +00:00
|
|
|
, passt
|
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-15 16:39:30 +00:00
|
|
|
binPath = lib.makeBinPath (lib.optionals stdenv.isLinux [
|
2023-03-04 12:14:45 +00:00
|
|
|
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
|
2023-08-04 22:07:22 +00:00
|
|
|
slirp4netns
|
2024-04-21 15:54:59 +00:00
|
|
|
passt
|
2023-03-04 12:14:45 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
in
|
2020-05-15 21:57:56 +00:00
|
|
|
buildGoModule rec {
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "podman";
|
2024-04-21 15:54:59 +00:00
|
|
|
version = "5.0.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}";
|
2024-04-21 15:54:59 +00:00
|
|
|
hash = "sha256-8Swqwyzu/WI9mG21bLF81Kk4kS2Ltg0GV9G3EcG/FnU=";
|
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
|
2024-04-21 15:54:59 +00:00
|
|
|
] ++ lib.optionals stdenv.isLinux [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./hardcode-paths.patch;
|
|
|
|
inherit crun runc gvisor youki conmon;
|
|
|
|
})
|
2022-12-17 10:02:37 +00:00
|
|
|
];
|
|
|
|
|
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 .
|
2023-04-29 16:46:19 +00:00
|
|
|
substituteInPlace Makefile --replace "/bin/bash" "${runtimeShell}"
|
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";
|
2023-03-24 00:07:29 +00:00
|
|
|
longDescription = ''
|
|
|
|
Podman (the POD MANager) is a tool for managing containers and images, volumes mounted into those containers, and pods made from groups of containers. Podman runs containers on Linux, but can also be used on Mac and Windows systems using a Podman-managed virtual machine. Podman is based on libpod, a library for container lifecycle management that is also contained in this repository. The libpod library provides APIs for managing containers, pods, container images, and volumes.
|
|
|
|
|
|
|
|
To install on NixOS, please use the option `virtualisation.podman.enable = true`.
|
|
|
|
'';
|
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;
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "podman";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|