nixpkgs/pkgs/applications/virtualization/podman/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

153 lines
3.5 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, fetchFromGitHub
, pkg-config
, installShellFiles
2020-05-14 07:36:01 +00:00
, buildGoModule
, gpgme
, lvm2
, btrfs-progs
2020-05-13 11:37:47 +00:00
, libapparmor
, libseccomp
2020-05-13 11:37:47 +00:00
, libselinux
, systemd
2019-02-08 12:38:46 +00:00
, go-md2man
2020-04-23 02:01:49 +00:00
, nixosTests
, python3
, makeWrapper
, symlinkJoin
, extraPackages ? [ ]
, runc
, crun
, conmon
, slirp4netns
, fuse-overlayfs
, util-linux
, iptables
, iproute2
, catatonit
, gvproxy
, aardvark-dns
, netavark
, testers
, podman
}:
let
# do not add qemu to this wrapper, store paths get written to the podman vm config and break when GCed
2023-02-28 12:59: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-14 07:36:01 +00:00
buildGoModule rec {
pname = "podman";
version = "4.4.2";
2018-12-18 09:53:40 +00:00
src = fetchFromGitHub {
owner = "containers";
2020-07-16 02:21:46 +00:00
repo = "podman";
rev = "v${version}";
hash = "sha256-337PFsPGm7pUgnFeNJKwT+/7AdbWSfCx4kXyAvHyWJQ=";
};
2018-12-18 09:53:40 +00:00
2022-12-12 01:44:50 +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
];
vendorHash = null;
2018-12-18 09:53:40 +00:00
doCheck = false;
outputs = [ "out" "man" ];
2019-02-08 12:38:46 +00:00
nativeBuildInputs = [ pkg-config go-md2man installShellFiles makeWrapper python3 ];
2018-12-18 09:53:40 +00:00
2021-01-15 05:42:41 +00:00
buildInputs = lib.optionals stdenv.isLinux [
2020-05-13 11:37:47 +00:00
btrfs-progs
gpgme
libapparmor
libseccomp
libselinux
lvm2
systemd
];
HELPER_BINARIES_DIR = "${PREFIX}/libexec/podman"; # used in buildPhase & installPhase
PREFIX = "${placeholder "out"}";
buildPhase = ''
2021-03-31 06:52:07 +00:00
runHook preBuild
patchShebangs .
${if stdenv.isDarwin then ''
make podman-remote # podman-mac-helper uses FHS paths
'' else ''
make bin/podman bin/rootlessport bin/quadlet
''}
2020-06-26 23:58:45 +00:00
make docs
2021-03-31 06:52:07 +00:00
runHook postBuild
'';
2018-12-18 09:53:40 +00:00
2021-03-31 06:52:07 +00:00
installPhase = ''
runHook preInstall
${if stdenv.isDarwin then ''
install bin/darwin/podman -Dt $out/bin
'' else ''
make install.bin install.systemd
''}
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-03-31 06:52:07 +00:00
runHook postInstall
'';
2021-05-26 15:56:20 +00:00
postFixup = lib.optionalString stdenv.isLinux ''
RPATH=$(patchelf --print-rpath $out/bin/.podman-wrapped)
patchelf --set-rpath "${lib.makeLibraryPath [ systemd ]}":$RPATH $out/bin/.podman-wrapped
2021-05-26 15:56:20 +00:00
'';
passthru.tests = {
version = testers.testVersion {
package = podman;
command = "HOME=$TMPDIR podman --version";
};
} // lib.optionalAttrs stdenv.isLinux {
inherit (nixosTests) podman;
# related modules
inherit (nixosTests)
podman-tls-ghostunnel
;
oci-containers-podman = nixosTests.oci-containers.podman;
};
2020-04-23 02:01:49 +00:00
meta = with lib; {
homepage = "https://podman.io/";
description = "A program for managing pods, containers and container images";
changelog = "https://github.com/containers/podman/blob/v${version}/RELEASE_NOTES.md";
license = licenses.asl20;
2020-04-03 10:11:25 +00:00
maintainers = with maintainers; [ marsam ] ++ teams.podman.members;
};
}