podman: Wrap packages required to run containers
This commit is contained in:
parent
cffb1cbcb2
commit
b2a9a3e9cb
@ -77,16 +77,7 @@ in
|
|||||||
|
|
||||||
config = lib.mkIf cfg.enable {
|
config = lib.mkIf cfg.enable {
|
||||||
|
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [ pkgs.podman ]
|
||||||
pkgs.podman # Docker compat
|
|
||||||
pkgs.runc # Default container runtime
|
|
||||||
pkgs.crun # Default container runtime (cgroups v2)
|
|
||||||
pkgs.conmon # Container runtime monitor
|
|
||||||
pkgs.slirp4netns # User-mode networking for unprivileged namespaces
|
|
||||||
pkgs.fuse-overlayfs # CoW for images, much faster than default vfs
|
|
||||||
pkgs.utillinux # nsenter
|
|
||||||
pkgs.iptables
|
|
||||||
]
|
|
||||||
++ lib.optional cfg.dockerCompat dockerCompat;
|
++ lib.optional cfg.dockerCompat dockerCompat;
|
||||||
|
|
||||||
environment.etc."containers/libpod.conf".text = ''
|
environment.etc."containers/libpod.conf".text = ''
|
||||||
@ -95,7 +86,7 @@ in
|
|||||||
|
|
||||||
'' + cfg.libpod.extraConfig;
|
'' + cfg.libpod.extraConfig;
|
||||||
|
|
||||||
environment.etc."cni/net.d/87-podman-bridge.conflist".source = copyFile "${pkgs.podman.src}/cni/87-podman-bridge.conflist";
|
environment.etc."cni/net.d/87-podman-bridge.conflist".source = copyFile "${pkgs.podman-unwrapped.src}/cni/87-podman-bridge.conflist";
|
||||||
|
|
||||||
# Enable common /etc/containers configuration
|
# Enable common /etc/containers configuration
|
||||||
virtualisation.containers.enable = true;
|
virtualisation.containers.enable = true;
|
||||||
|
48
pkgs/applications/virtualization/podman/wrapper.nix
Normal file
48
pkgs/applications/virtualization/podman/wrapper.nix
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
{ podman-unwrapped
|
||||||
|
, runCommand
|
||||||
|
, makeWrapper
|
||||||
|
, lib
|
||||||
|
, extraPackages ? []
|
||||||
|
, podman # Docker compat
|
||||||
|
, runc # Default container runtime
|
||||||
|
, crun # Default container runtime (cgroups v2)
|
||||||
|
, conmon # Container runtime monitor
|
||||||
|
, slirp4netns # User-mode networking for unprivileged namespaces
|
||||||
|
, fuse-overlayfs # CoW for images, much faster than default vfs
|
||||||
|
, utillinux # nsenter
|
||||||
|
, cni-plugins
|
||||||
|
, iptables
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
podman = podman-unwrapped;
|
||||||
|
|
||||||
|
binPath = lib.makeBinPath ([
|
||||||
|
runc
|
||||||
|
crun
|
||||||
|
conmon
|
||||||
|
slirp4netns
|
||||||
|
fuse-overlayfs
|
||||||
|
utillinux
|
||||||
|
iptables
|
||||||
|
] ++ extraPackages);
|
||||||
|
|
||||||
|
in runCommand podman.name {
|
||||||
|
inherit (podman) name pname version meta outputs;
|
||||||
|
nativeBuildInputs = [
|
||||||
|
makeWrapper
|
||||||
|
];
|
||||||
|
|
||||||
|
} ''
|
||||||
|
# Symlink everything but $bin from podman-unwrapped
|
||||||
|
${
|
||||||
|
lib.concatMapStringsSep "\n"
|
||||||
|
(o: "ln -s ${podman.${o}} ${placeholder o}")
|
||||||
|
(builtins.filter (o: o != "bin")
|
||||||
|
podman.outputs)}
|
||||||
|
|
||||||
|
mkdir -p $bin/bin
|
||||||
|
ln -s ${podman-unwrapped}/share $bin/share
|
||||||
|
makeWrapper ${podman-unwrapped}/bin/podman $bin/bin/podman \
|
||||||
|
--prefix PATH : ${binPath}
|
||||||
|
''
|
@ -5966,7 +5966,8 @@ in
|
|||||||
|
|
||||||
podiff = callPackage ../tools/text/podiff { };
|
podiff = callPackage ../tools/text/podiff { };
|
||||||
|
|
||||||
podman = callPackage ../applications/virtualization/podman { };
|
podman = callPackage ../applications/virtualization/podman/wrapper.nix { };
|
||||||
|
podman-unwrapped = callPackage ../applications/virtualization/podman { };
|
||||||
|
|
||||||
podman-compose = python3Packages.callPackage ../applications/virtualization/podman-compose {};
|
podman-compose = python3Packages.callPackage ../applications/virtualization/podman-compose {};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user