diff --git a/nixos/modules/virtualisation/oci-containers.nix b/nixos/modules/virtualisation/oci-containers.nix index 61593dc234ab73..94b7a2b17b7971 100644 --- a/nixos/modules/virtualisation/oci-containers.nix +++ b/nixos/modules/virtualisation/oci-containers.nix @@ -14,7 +14,7 @@ let defaultBackend = options.virtualisation.oci-containers.backend.default; containerOptions = - { ... }: + { name, ... }: { options = { @@ -59,6 +59,12 @@ let example = literalExpression "pkgs.dockerTools.streamLayeredImage {...};"; }; + serviceName = mkOption { + type = types.str; + default = "${cfg.backend}-${name}"; + description = "Systemd service name that manages the container"; + }; + login = { username = mkOption { @@ -526,7 +532,7 @@ in lib.mkMerge [ { systemd.services = mapAttrs' ( - n: v: nameValuePair "${cfg.backend}-${n}" (mkService n v) + n: v: nameValuePair v.serviceName (mkService n v) ) cfg.containers; assertions =