Skip to content

Container Options ​

This project extends Home Managers existing services.podman.containers options, to provide additional abstractions for example for Traefik or Homepage.

While you won't need to set any of those to get the stacks up and running, they can be useful when customizing settings.

The options can be set directly on services.podman.container level, or through the stack aliases provided with this project. For example, the following two configurations are equivalent:

nix
nps.stacks = {
    streaming.containers.jellyfin.expose = true;
};
nix
services.podman.containers.jellyfin.expose = true;

The following list contains all extension options that will be added by this project.


services.podman.containers.<name>.alloy.enable ​

Alloy Log Scraping. If enabled, Alloy will scrape logs from the container and ship them to Loki.;

Type
plaintext
boolean
Default
nix
config.nps.stacks.monitoring.alloy.collectByDefault
Declaration

services.podman.containers.<name>.dashboard ​

Metadata shared between the dashboards. Settings that only apply to a single dashboard go into its own container option.

Type
plaintext
submodule
Default
nix
{ }
Declaration

services.podman.containers.<name>.dashboard.category ​

Category of the service, null hides it.

Type
plaintext
null or string
Default
nix
null
Declaration

services.podman.containers.<name>.dashboard.description ​

Short description of the service.

Type
plaintext
null or string
Default
nix
null
Declaration

services.podman.containers.<name>.dashboard.icon ​

Icon in Glance syntax, translated for Homepage. di:name becomes name, sh:name becomes sh-name, a bare name is resolved via dashboard-icons.

Type
plaintext
null or string
Default
nix
null
Example
nix
"di:jellyfin"
Declaration

services.podman.containers.<name>.dashboard.id ​

Identifier of the service, referenced by the parent of its child containers. Defaults to the container name.

Type
plaintext
null or string
Default
nix
null
Declaration

services.podman.containers.<name>.dashboard.name ​

Name of the service on the dashboards.

Type
plaintext
string
Default
nix
lib.toSentenceCase "<container name>"
Declaration

services.podman.containers.<name>.dashboard.parent ​

Identifier of the service this container belongs to. Groups it below the parent on the dashboard and keeps it off Homepage, set homepage.category to show it there anyway.

Type
plaintext
null or string
Default
nix
null
Declaration

services.podman.containers.<name>.dashboard.url ​

URL the service links to, defaults to the Traefik serviceUrl.

Type
plaintext
null or string
Default
nix
config.traefik.serviceUrl
Declaration

services.podman.containers.<name>.dependsOn ​

List of systemd resources that this container depends on. This is a hard requirement and will setup systemd Require and After attributes. When specifying a dependency on another container, use the option dependsOnContainer instead.

See

Type
plaintext
list of string
Default
nix
[ ]
Declaration

services.podman.containers.<name>.dependsOnContainer ​

List of containers that this container depends on. Similar to dependsOn, but will automatically apply correct pre- and suffix for the generated systemd services.

Type
plaintext
list of string
Default
nix
[ ]
Declaration

services.podman.containers.<name>.dynacat ​

Type
plaintext
open submodule of (YAML 1.1 value)
Default
nix
{ }
Declaration

services.podman.containers.<name>.dynacat.category ​

Category of the service, null hides it on Dynacat.

Type
plaintext
null or string
Default
nix
null
Declaration

services.podman.containers.<name>.dynacat.name ​

The name of the service as it will displayed on the dashboard.

Type
plaintext
string
Default
nix
"‹name›"
Declaration

services.podman.containers.<name>.dynacat.url ​

The URL of the service.

Type
plaintext
string
Default
nix
""
Declaration

services.podman.containers.<name>.environment ​

This option has no description.

Type
plaintext
unspecified value
Declaration

services.podman.containers.<name>.expose ​

Whether the service should be exposed (e.g. reachable from external IP addresses). When set to false, the private middleware will be applied by Traefik. The private middleware will only allow requests from private CIDR ranges.

When set to true, the public middleware will be applied. The public middleware will allow access from the internet. It will be configured with a rate limit, security headers and a geoblock plugin (if enabled). If enabled, Crowdsec will also be added to the public middleware chain.

Type
plaintext
boolean
Default
nix
false
Declaration

services.podman.containers.<name>.extraEnv ​

Convinience wrapper option for passing environment variables to the container. The values of the environment variables can either be a primitive value or a path to a file.

In case of passing a path (using the fromFile attribure), the file will be read and the content will be set as the value of the environment variable. Useful for containers that don't support passing environment variables using the "_FILE" pattern.

Type
plaintext
attribute set of (null or boolean or signed integer or string or absolute path or (submodule))
Default
nix
{ }
Example
nix
{
  API_KEY = {
    fromFile = "/home/user/api-key";
  };
  DB_PASSWORD = {
    fromFile = "/some/path/secrets/db-password";
  };
  DB_URL = {
    fromTemplate = "postgresql://user:{{ file.Read `/run/secrets/db_password` }}@localhost:5432/mydb";
  };
  ENCRYPTION_KEY = "literal-value";
}
Declaration

services.podman.containers.<name>.fileEnvMount ​

Convenience wrapper option, that simplifies passing _FILE based environment variables. For each attribute in the attrset, a volume mapping from sourcePath to destPath will be added, and an environment variable will be set to the destPath.

Example:

nix
API_KEY_FILE = {
  srcPath = "/host/api-key.txt";
  dstPath = "/container/api-key.txt";
};

will add a volume to the container, e.g.:

nix
volumes = [${sourcePath}:${destPath}];

and also add an environment variable:

nix
env.API_KEY_FILE = destPath;

You can also provide a simple path, which will be treated as the sourcePath:

nix
DB_PASSWORD_FILE = ./secrets/db-password.txt;

The destPath will be inferred.

Type
plaintext
attribute set of (absolute path or (submodule))
Default
nix
{ }
Example
nix
{
  API_KEY_FILE = {
    destPath = "/app/config/api-key.txt";
    sourcePath = "/secrets/api-key.txt";
  };
  DB_PASSWORD_FILE = "/run/secrets/db-password.txt";
}
Declaration

services.podman.containers.<name>.forwardAuth.enable ​

Whether to enable forward auth. This will enable the authelia Traefik middleware for this container. Every request will be forwarded to be authorized by Authelia first.

Optionally, access control rules for this container can be specified in the settings. They will be added to the Authelia settings.

See https://www.authelia.com/configuration/security/access-control/

Type
plaintext
boolean
Default
nix
false
Declaration

services.podman.containers.<name>.forwardAuth.middlewareOrder ​

Order of the authelia middleware. Multiple middlewares will be called in order by Traefik, with lower orders being called first.

Type
plaintext
signed integer
Default
nix
1000
Declaration

services.podman.containers.<name>.forwardAuth.rules ​

Rules matching a request. When all criteria of a rule match the request, the defined policy is applied.

See https://www.authelia.com/configuration/security/access-control/#rules

Type
plaintext
list of (submodule)
Default
nix
[ ]
Declaration

services.podman.containers.<name>.forwardAuth.rules.*.domain ​

Domain(s) that will be matched for the rule. Defaults to the servie domain registered in Traefik. Either this, or the domain_regex options has to be set.

See https://www.authelia.com/configuration/security/access-control/#domain

Type
plaintext
list of string
Default
nix
[ containerCfg.traefik.serviceHost ]
Declaration

services.podman.containers.<name>.forwardAuth.rules.*.domain_regex ​

Regex(es) criteria matching the domain. Defaults to the servie domain registered in Traefik. Has to be set if the domain is unset.

See https://www.authelia.com/configuration/security/access-control/#domain_regex

Type
plaintext
list of string
Default
nix
[ ]
Declaration

services.podman.containers.<name>.forwardAuth.rules.*.methods ​

Type
plaintext
list of string
Default
nix
[ ]
Declaration

services.podman.containers.<name>.forwardAuth.rules.*.networks ​

Critera matching the network. Can be a list of IP addresses, CIDR ranges or named network definitions.

See https://www.authelia.com/configuration/security/access-control/#networks

Type
plaintext
list of string
Default
nix
[ ]
Declaration

services.podman.containers.<name>.forwardAuth.rules.*.policy ​

The specific policy to apply to the selected rule. This is not criteria for a match, this is the action to take when a match is made.

See https://www.authelia.com/configuration/security/access-control/#policy

Type
plaintext
one of "", "deny", "bypass", "one_factor", "two_factor"
Default
nix
""
Declaration

services.podman.containers.<name>.forwardAuth.rules.*.resources ​

Critera matching the path and query parameter using regular expressions.

See https://www.authelia.com/configuration/security/access-control/#resources

Type
plaintext
list of string
Default
nix
[ ]
Declaration

services.podman.containers.<name>.forwardAuth.rules.*.subject ​

Type
plaintext
list of (string or list of string)
Default
nix
[ ]
Declaration

services.podman.containers.<name>.forwardAuth.rulesOrder ​

Order of rules when merged into the authelia settings. The order will be applied using lib.mkOrder <order> when applying the rules in the Authelia settings. Lower numbers mean the rules will appear earlier in the access_control.rules list, which give them a higher priority.

See https://www.authelia.com/configuration/security/access-control/#rule-matching-concept-1-sequential-order

Type
plaintext
signed integer
Default
nix
1000
Declaration

services.podman.containers.<name>.gatus.enable ​

Whether to enable gatus.

Type
plaintext
boolean
Default
nix
false
Example
nix
true
Declaration

services.podman.containers.<name>.gatus.settings ​

Endpoint Settings for the container. Will be added to the Gatus endpoint configuration.

See https://github.com/TwiN/gatus?tab=readme-ov-file#endpoints

Type
plaintext
YAML 1.1 value
Default
nix
{ }
Declaration

services.podman.containers.<name>.glance ​

Type
plaintext
open submodule of (YAML 1.1 value)
Default
nix
{ }
Declaration

services.podman.containers.<name>.glance.category ​

Category of the service, null hides it on Glance.

Type
plaintext
null or string
Default
nix
null
Declaration

services.podman.containers.<name>.glance.name ​

The name of the service as it will displayed on the dashboard.

Type
plaintext
string
Default
nix
"‹name›"
Declaration

services.podman.containers.<name>.glance.url ​

The URL of the service.

Type
plaintext
string
Default
nix
""
Declaration

services.podman.containers.<name>.homepage.category ​

Category of the service, null hides it on Homepage. Containers with a dashboard.parent are hidden by default.

Type
plaintext
null or string
Default
nix
config.dashboard.category
Declaration

services.podman.containers.<name>.homepage.name ​

The name of the service as it will appear on the Homepage dashboard.

Type
plaintext
string
Default
nix
"‹name›"
Declaration

services.podman.containers.<name>.homepage.settings ​

Settings for the Homepage service. This can include widget configuration, rank and so on.

See https://gethomepage.dev/configs/services/#services/

Type
plaintext
YAML 1.1 value
Default
nix
{ }
Declaration

services.podman.containers.<name>.port ​

Main port that Traefik will forward traffic to. If Traefik is disabled, it will instead be added to the "ports" section

Type
plaintext
null or string or signed integer
Default
nix
null
Declaration

services.podman.containers.<name>.sablier ​

Sablier labels for the container. Must use the systemd style label names. The labels will be provided in the [X-Sablier] section of the unit file for the container.

Type
plaintext
open submodule of attribute set of string
Default
nix
{ }
Declaration

services.podman.containers.<name>.sablier.enable ​

Whether to enable Sablier integration.

Type
plaintext
boolean
Default
nix
false
Example
nix
true
Declaration

services.podman.containers.<name>.sablier.group ​

Group the container belongs to.

For details see https://sablierapp.dev/concepts/groups/

Type
plaintext
string
Default
nix
containerCfg.stack
Declaration

services.podman.containers.<name>.sablier.middleware ​

Options for the Traefik Sablier middleware of this container's group.

All containers of a group share one middleware. Their settings are merged: attribute sets recursively, lists as a union, other values with the last one winning.

For details see https://plugins.traefik.io/plugins/69104ac3b7d4dd76110a1a09/sablier

Type
plaintext
attribute set of (YAML 1.1 value)
Default
nix
{ }
Declaration

services.podman.containers.<name>.socketActivation ​

List of socket activation configurations for this container. Each entry should specify a port and optionally a file descriptor name. This will create a systemd socket that activates the container when accessed.

Will be used by containers like Traefik by default. Allows the container to access real-ip without the request being proxied through pasta/slirp4netns.

For details regarding rootless Podman networking and socket activation, see: https://github.com/eriksjolund/podman-networking-docs

Type
plaintext
list of (submodule)
Default
nix
[ ]
Declaration

services.podman.containers.<name>.socketActivation.*.fileDescriptorName ​

Name of the file descriptor that the socket should use.

Type
plaintext
null or string
Default
nix
null
Declaration

services.podman.containers.<name>.socketActivation.*.port ​

Port that the socket should listen on

Type
plaintext
string or 16 bit unsigned integer; between 0 and 65535 (both inclusive)
Declaration

services.podman.containers.<name>.socketProxyPermissions ​

Regex allowlists for socket-proxy access, one list per HTTP method. Generates one label per pattern, e.g. socket-proxy.allow.get and socket-proxy.allow.get.1. See nps.stacks.socket-proxy.sections.

Type
plaintext
attribute set of list of string
Default
nix
{ }
Example
nix
{
  GET = [config.nps.stacks.socket-proxy.sections.containers];
  POST = [config.nps.stacks.socket-proxy.sections.build "some custom regex"];
}
Declaration

services.podman.containers.<name>.stack ​

Stack that a container is part of. For every stack, a Podman networking will be crearted that the respective container will be connected to.

Type
plaintext
null or string
Default
nix
null
Declaration

services.podman.containers.<name>.templateMount ​

Bind mount that will render the template with gomplate. The resulting file will be mounted into the container.

All environment variables from the environment and extraEnv options will be available for substitution.

See

Type
plaintext
list of (submodule)
Default
nix
[ ]
Example
nix
[
  {
    templatePath = pkgs.writeText "some-template" ''
      Hello {{ env.GetEnv "USER" "you" }}
      Secret Password is: {{ file.ReadFile "/run/secrets/some_secret" }}
    '';
    destPath = "/run/secrets/templated_file";
  }
]
Declaration

services.podman.containers.<name>.templateMount.*.chown ​

Optional user and group that should own the templated file inside the container. This will run run podman unshare chown <user:group> <destPath> on the templated file.

Type
plaintext
null or (submodule)
Default
nix
null
Declaration

services.podman.containers.<name>.templateMount.*.chown.group ​

Group that should own the file

Type
plaintext
string
Declaration

services.podman.containers.<name>.templateMount.*.chown.user ​

User that should own the file

Type
plaintext
string
Declaration

services.podman.containers.<name>.templateMount.*.destPath ​

Destination path of the templated file within the container

Type
plaintext
absolute path
Declaration

services.podman.containers.<name>.templateMount.*.templatePath ​

Path to the template. The file will be templated with gomplate before being mounted.

Type
plaintext
absolute path
Declaration

services.podman.containers.<name>.traefik.middleware ​

A mapping of middleware name to a boolean that indicated if the middleware should be applied to the service.

Type
plaintext
attribute set of (submodule)
Default
nix
{ }
Declaration

services.podman.containers.<name>.traefik.middleware.<name>.enable ​

Whether the middleware should be applied to the service

Type
plaintext
boolean
Default
nix
false
Declaration

services.podman.containers.<name>.traefik.middleware.<name>.order ​

Order of the middleware. Middlewares will be called in order by Traefik. Lower number means higher priority.

Type
plaintext
signed integer
Default
nix
1000
Declaration

services.podman.containers.<name>.traefik.name ​

The name of the service as it will be registered in Traefik. Will be used as a default for the subdomain.

If not set (null), the service will not be registered in Traefik.

Type
plaintext
null or string
Default
nix
null
Declaration

services.podman.containers.<name>.traefik.rule ​

Traefik router rule.

Type
plaintext
string
Default
nix
"Host(`${traefikCfg.serviceHost}`)"
Declaration

services.podman.containers.<name>.traefik.scheme ​

Scheme Traefik uses to talk to the service. Use h2c for backends that speak HTTP/2 in clear text, such as gRPC servers.

Type
plaintext
string
Default
nix
"http"
Declaration

services.podman.containers.<name>.traefik.serviceAddressInternal ​

The internal main address of the service. Can be used for internal communication without going through Traefik, when inside the same Podman network.

If the container shares another container's network namespace (e.g. via network = ["container:gluetun"]), the address of that container is used instead

Type
plaintext
string
Default
nix
"${containerName}:${containerCfg.port}"
Declaration

services.podman.containers.<name>.traefik.serviceHost ​

The host name of the service as it will be registered in Traefik.

Type
plaintext
string
Default
nix
"${traefikCfg.subDomain}.${nps.stacks.traefik.domain}"
Declaration

services.podman.containers.<name>.traefik.serviceUrl ​

The full URL of the service as it will be registered in Traefik. This will be the serviceHost including the "https://" prefix.

Type
plaintext
string
Default
nix
"https://${traefikCfg.serviceHost}"
Declaration

services.podman.containers.<name>.traefik.subDomain ​

The subdomain of the service as it will be registered in Traefik.

Type
plaintext
string
Default
nix
"traefikCfg.name"
Declaration

services.podman.containers.<name>.volumeMap ​

Attribute set of named volume mappings. This is just a wrapper of the volumes option, that allows defining volume mappings using an attrset.

The stack modules will use the volumeMap to set volume mappings for the container. This allows overriding specific volume mappings without having to redefine the entire volumes list.

Type
plaintext
attribute set of string
Default
nix
{ }
Example
nix
{
  config = "/host/bar/config:/config";
  db = "/host/foo/db:/db";
}
Declaration

services.podman.containers.<name>.wants ​

List of systemd resources that this container depends on. Compared to dependsOn, this is a softer requirement and will setup systemd Wants and After attributes. When specifying a dependency on another container, use the option wantsContainer instead.

See

Type
plaintext
list of string
Default
nix
[ ]
Declaration

services.podman.containers.<name>.wantsContainer ​

List of containers that this container depends on. Similar to wants, but will automatically apply correct pre- and suffix for the generated systemd services.

Type
plaintext
list of string
Default
nix
[ ]
Declaration