10 cfg = config.virtualisation.cri-o;
12 crioPackage = pkgs.cri-o.override {
15 ++ lib.optional (config.boot.supportedFilesystems.zfs or false) config.boot.zfs.package;
18 format = pkgs.formats.toml { };
20 cfgFile = format.generate "00-default.conf" cfg.settings;
24 maintainers = teams.podman.members;
27 options.virtualisation.cri-o = {
28 enable = mkEnableOption "Container Runtime Interface for OCI (CRI-O)";
30 storageDriver = mkOption {
40 description = "Storage driver to be used";
53 description = "Log level to be used";
56 pauseImage = mkOption {
57 type = types.nullOr types.str;
59 description = "Override the default pause image for pod sandboxes";
60 example = "k8s.gcr.io/pause:3.2";
63 pauseCommand = mkOption {
64 type = types.nullOr types.str;
66 description = "Override the default pause command";
71 type = types.nullOr types.str;
73 description = "Override the default runtime";
77 extraPackages = mkOption {
78 type = with types; listOf package;
80 example = literalExpression ''
86 Extra packages to be installed in the CRI-O wrapper.
92 default = crioPackage;
95 The final CRI-O package (including extra packages).
99 networkDir = mkOption {
100 type = types.nullOr types.path;
102 description = "Override the network_dir option.";
106 settings = mkOption {
110 Configuration for cri-o, see
111 <https://github.com/cri-o/cri-o/blob/master/docs/crio.conf.5.md>.
116 config = mkIf cfg.enable {
117 environment.systemPackages = [
122 environment.etc."crictl.yaml".source = "${cfg.package}/etc/crictl.yaml";
124 virtualisation.cri-o.settings.crio = {
125 storage_driver = cfg.storageDriver;
128 pause_image = mkIf (cfg.pauseImage != null) cfg.pauseImage;
129 pause_command = mkIf (cfg.pauseCommand != null) cfg.pauseCommand;
133 plugin_dirs = [ "${pkgs.cni-plugins}/bin" ];
134 network_dir = mkIf (cfg.networkDir != null) cfg.networkDir;
138 cgroup_manager = "systemd";
139 log_level = cfg.logLevel;
140 manage_ns_lifecycle = true;
141 pinns_path = "${cfg.package}/bin/pinns";
142 hooks_dir = optional (config.virtualisation.containers.ociSeccompBpfHook.enable) config.boot.kernelPackages.oci-seccomp-bpf-hook;
144 default_runtime = mkIf (cfg.runtime != null) cfg.runtime;
145 runtimes = mkIf (cfg.runtime != null) {
146 "${cfg.runtime}" = { };
151 environment.etc."cni/net.d/10-crio-bridge.conflist".source =
152 "${cfg.package}/etc/cni/net.d/10-crio-bridge.conflist";
153 environment.etc."cni/net.d/99-loopback.conflist".source =
154 "${cfg.package}/etc/cni/net.d/99-loopback.conflist";
155 environment.etc."crio/crio.conf.d/00-default.conf".source = cfgFile;
157 # Enable common /etc/containers configuration
158 virtualisation.containers.enable = true;
160 systemd.services.crio = {
161 description = "Container Runtime Interface for OCI (CRI-O)";
162 documentation = [ "https://github.com/cri-o/cri-o" ];
163 wantedBy = [ "multi-user.target" ];
164 after = [ "network.target" ];
165 path = [ cfg.package ];
168 ExecStart = "${cfg.package}/bin/crio";
169 ExecReload = "/bin/kill -s HUP $MAINPID";
170 TasksMax = "infinity";
171 LimitNOFILE = "1048576";
172 LimitNPROC = "1048576";
173 LimitCORE = "infinity";
174 OOMScoreAdjust = "-999";
175 TimeoutStartSec = "0";
176 Restart = "on-abnormal";
178 restartTriggers = [ cfgFile ];