From 1481d3f46200ee9bb253e8cd0eb1048761184f7b Mon Sep 17 00:00:00 2001 From: Minijackson Date: Fri, 22 Nov 2024 17:13:41 +0100 Subject: [PATCH] nixos/containers: format --- nixos/modules/virtualisation/containers.nix | 49 ++++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/nixos/modules/virtualisation/containers.nix b/nixos/modules/virtualisation/containers.nix index df4fdabe52ab7..33a888a6da911 100644 --- a/nixos/modules/virtualisation/containers.nix +++ b/nixos/modules/virtualisation/containers.nix @@ -1,4 +1,9 @@ -{ config, lib, pkgs, ... }: +{ + config, + lib, + pkgs, + ... +}: let cfg = config.virtualisation.containers; @@ -22,14 +27,13 @@ in options.virtualisation.containers = { - enable = - mkOption { - type = types.bool; - default = false; - description = '' - This option enables the common /etc/containers configuration module. - ''; - }; + enable = mkOption { + type = types.bool; + default = false; + description = '' + This option enables the common /etc/containers configuration module. + ''; + }; ociSeccompBpfHook.enable = mkOption { type = types.bool; @@ -155,11 +159,13 @@ in virtualisation.containers.containersConf.settings = { network.cni_plugin_dirs = map (p: "${lib.getBin p}/bin") cfg.containersConf.cniPlugins; - engine = { - init_path = "${pkgs.catatonit}/bin/catatonit"; - } // lib.optionalAttrs cfg.ociSeccompBpfHook.enable { - hooks_dir = [ config.boot.kernelPackages.oci-seccomp-bpf-hook ]; - }; + engine = + { + init_path = "${pkgs.catatonit}/bin/catatonit"; + } + // lib.optionalAttrs cfg.ociSeccompBpfHook.enable { + hooks_dir = [ config.boot.kernelPackages.oci-seccomp-bpf-hook ]; + }; }; virtualisation.containers.storage.settings.storage = { @@ -169,18 +175,17 @@ in }; environment.etc = { - "containers/containers.conf".source = - toml.generate "containers.conf" cfg.containersConf.settings; + "containers/containers.conf".source = toml.generate "containers.conf" cfg.containersConf.settings; - "containers/storage.conf".source = - toml.generate "storage.conf" cfg.storage.settings; + "containers/storage.conf".source = toml.generate "storage.conf" cfg.storage.settings; - "containers/registries.conf".source = - toml.generate "registries.conf" cfg.registries.settings; + "containers/registries.conf".source = toml.generate "registries.conf" cfg.registries.settings; "containers/policy.json".source = - if cfg.policy != { } then pkgs.writeText "policy.json" (builtins.toJSON cfg.policy) - else "${pkgs.skopeo.policy}/default-policy.json"; + if cfg.policy != { } then + pkgs.writeText "policy.json" (builtins.toJSON cfg.policy) + else + "${pkgs.skopeo.policy}/default-policy.json"; }; };