nixos/cri-o: add networkDir option

The new option can be used to specify the network directory for CNI
plugin configurations.

Signed-off-by: Sascha Grunert <sgrunert@suse.com>
This commit is contained in:
Sascha Grunert 2020-09-16 11:44:27 +02:00 committed by zowoq
parent f9666eb863
commit eac4389021

View file

@ -1,14 +1,13 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.virtualisation.cri-o;
crioPackage = (pkgs.cri-o.override { inherit (cfg) extraPackages; });
# Copy configuration files to avoid having the entire sources in the system closure
copyFile = filePath: pkgs.runCommandNoCC (builtins.unsafeDiscardStringContext (builtins.baseNameOf filePath)) {} ''
copyFile = filePath: pkgs.runCommandNoCC (builtins.unsafeDiscardStringContext (builtins.baseNameOf filePath)) { } ''
cp ${filePath} $out
'';
in
@ -78,6 +77,13 @@ in
The final CRI-O package (including extra packages).
'';
};
networkDir = mkOption {
type = types.nullOr types.path;
default = null;
description = "Override the network_dir option.";
internal = true;
};
};
config = mkIf cfg.enable {
@ -95,6 +101,7 @@ in
[crio.network]
plugin_dirs = ["${pkgs.cni-plugins}/bin/"]
${optionalString (cfg.networkDir != null) ''network_dir = "${cfg.networkDir}"''}
[crio.runtime]
cgroup_manager = "systemd"