Skip to content

Commit

Permalink
nixos/oci-containers: option to set the service name of a oci-container
Browse files Browse the repository at this point in the history
Signed-off-by: lucasew <[email protected]>
  • Loading branch information
lucasew committed Jan 2, 2025
1 parent d836dc6 commit fb63e14
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions nixos/modules/virtualisation/oci-containers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let
defaultBackend = options.virtualisation.oci-containers.backend.default;

containerOptions =
{ ... }:
{ name, ... }:
{

options = {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 =
Expand Down

0 comments on commit fb63e14

Please sign in to comment.