nixos.podman: Expose extraPackages from the podman wrapper

This commit is contained in:
adisbladis 2020-04-28 21:27:18 +01:00
parent b2a9a3e9cb
commit 78cba5ac1e
No known key found for this signature in database
GPG key ID: 110BFAD44C6249B7

View file

@ -4,18 +4,20 @@ let
inherit (lib) mkOption types;
podmanPackage = (pkgs.podman.override { inherit (cfg) extraPackages; });
# Provides a fake "docker" binary mapping to podman
dockerCompat = pkgs.runCommandNoCC "${pkgs.podman.pname}-docker-compat-${pkgs.podman.version}" {
dockerCompat = pkgs.runCommandNoCC "${podmanPackage.pname}-docker-compat-${podmanPackage.version}" {
outputs = [ "out" "bin" "man" ];
inherit (pkgs.podman) meta;
inherit (podmanPackage) meta;
} ''
mkdir $out
mkdir -p $bin/bin
ln -s ${pkgs.podman.bin}/bin/podman $bin/bin/docker
ln -s ${podmanPackage.bin}/bin/podman $bin/bin/docker
mkdir -p $man/share/man/man1
for f in ${pkgs.podman.man}/share/man/man1/*; do
for f in ${podmanPackage.man}/share/man/man1/*; do
basename=$(basename $f | sed s/podman/docker/g)
ln -s $f $man/share/man/man1/$basename
done
@ -54,6 +56,19 @@ in
'';
};
extraPackages = mkOption {
type = with types; listOf package;
default = [ ];
example = lib.literalExample ''
[
pkgs.gvisor
]
'';
description = ''
Extra packages to be installed in the Podman wrapper.
'';
};
libpod = mkOption {
default = {};
description = "Libpod configuration";
@ -77,12 +92,11 @@ in
config = lib.mkIf cfg.enable {
environment.systemPackages = [ pkgs.podman ]
environment.systemPackages = [ podmanPackage ]
++ lib.optional cfg.dockerCompat dockerCompat;
environment.etc."containers/libpod.conf".text = ''
cni_plugin_dir = ["${pkgs.cni-plugins}/bin/"]
cni_config_dir = "/etc/cni/net.d/"
'' + cfg.libpod.extraConfig;