diff --git a/nixos/modules/virtualisation/oci-containers.nix b/nixos/modules/virtualisation/oci-containers.nix index 61593dc234ab..89e2b7e0f863 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,13 @@ let example = literalExpression "pkgs.dockerTools.streamLayeredImage {...};"; }; + serviceName = mkOption { + type = types.str; + default = "${cfg.backend}-${name}"; + defaultText = "-"; + description = "Systemd service name that manages the container"; + }; + login = { username = mkOption { @@ -525,9 +532,7 @@ in config = lib.mkIf (cfg.containers != { }) ( lib.mkMerge [ { - systemd.services = mapAttrs' ( - n: v: nameValuePair "${cfg.backend}-${n}" (mkService n v) - ) cfg.containers; + systemd.services = mapAttrs' (n: v: nameValuePair v.serviceName (mkService n v)) cfg.containers; assertions = let