mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-12 04:35:41 +03:00
nixos/oci-containers: option to set the service name of a oci-container
Signed-off-by: lucasew <lucas59356@gmail.com>
This commit is contained in:
parent
d836dc6ebf
commit
d01038921c
1 changed files with 9 additions and 4 deletions
|
@ -14,7 +14,7 @@ let
|
||||||
defaultBackend = options.virtualisation.oci-containers.backend.default;
|
defaultBackend = options.virtualisation.oci-containers.backend.default;
|
||||||
|
|
||||||
containerOptions =
|
containerOptions =
|
||||||
{ ... }:
|
{ name, ... }:
|
||||||
{
|
{
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
|
@ -59,6 +59,13 @@ let
|
||||||
example = literalExpression "pkgs.dockerTools.streamLayeredImage {...};";
|
example = literalExpression "pkgs.dockerTools.streamLayeredImage {...};";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
serviceName = mkOption {
|
||||||
|
type = types.str;
|
||||||
|
default = "${cfg.backend}-${name}";
|
||||||
|
defaultText = "<backend>-<name>";
|
||||||
|
description = "Systemd service name that manages the container";
|
||||||
|
};
|
||||||
|
|
||||||
login = {
|
login = {
|
||||||
|
|
||||||
username = mkOption {
|
username = mkOption {
|
||||||
|
@ -525,9 +532,7 @@ in
|
||||||
config = lib.mkIf (cfg.containers != { }) (
|
config = lib.mkIf (cfg.containers != { }) (
|
||||||
lib.mkMerge [
|
lib.mkMerge [
|
||||||
{
|
{
|
||||||
systemd.services = mapAttrs' (
|
systemd.services = mapAttrs' (n: v: nameValuePair v.serviceName (mkService n v)) cfg.containers;
|
||||||
n: v: nameValuePair "${cfg.backend}-${n}" (mkService n v)
|
|
||||||
) cfg.containers;
|
|
||||||
|
|
||||||
assertions =
|
assertions =
|
||||||
let
|
let
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue