nixos/{podman,containers}: libpod.conf -> containers.conf

This commit is contained in:
zowoq 2020-05-14 16:28:32 +10:00
parent 033ba9c73d
commit e89446656d
2 changed files with 29 additions and 24 deletions

View File

@ -34,6 +34,25 @@ in
''; '';
}; };
containersConf = mkOption {
default = {};
description = "containers.conf configuration";
type = types.submodule {
options = {
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration that should be put in the containers.conf
configuration file
'';
};
};
};
};
registries = { registries = {
search = mkOption { search = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
@ -93,6 +112,12 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
environment.etc."containers/containers.conf".text = ''
[network]
cni_plugin_dirs = ["${pkgs.cni-plugins}/bin/"]
'' + cfg.containersConf.extraConfig;
environment.etc."containers/registries.conf".source = toTOML "registries.conf" { environment.etc."containers/registries.conf".source = toTOML "registries.conf" {
registries = lib.mapAttrs (n: v: { registries = v; }) cfg.registries; registries = lib.mapAttrs (n: v: { registries = v; }) cfg.registries;
}; };

View File

@ -28,6 +28,10 @@ let
in in
{ {
imports = [
(lib.mkRenamedOptionModule [ "virtualisation" "podman" "libpod" ] [ "virtualisation" "containers" "containersConf" ])
];
meta = { meta = {
maintainers = lib.teams.podman.members; maintainers = lib.teams.podman.members;
}; };
@ -67,25 +71,6 @@ in
''; '';
}; };
libpod = mkOption {
default = {};
description = "Libpod configuration";
type = types.submodule {
options = {
extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration that should be put in the libpod.conf
configuration file
'';
};
};
};
};
package = lib.mkOption { package = lib.mkOption {
type = types.package; type = types.package;
default = podmanPackage; default = podmanPackage;
@ -103,11 +88,6 @@ in
environment.systemPackages = [ cfg.package ] environment.systemPackages = [ cfg.package ]
++ lib.optional cfg.dockerCompat dockerCompat; ++ lib.optional cfg.dockerCompat dockerCompat;
environment.etc."containers/libpod.conf".text = ''
cni_plugin_dir = ["${pkgs.cni-plugins}/bin/"]
'' + cfg.libpod.extraConfig;
environment.etc."cni/net.d/87-podman-bridge.conflist".source = copyFile "${pkgs.podman-unwrapped.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