Skip to content

wg-portal

GUI to manage your WireGuard peers and interfaces

Example

nix
{config, ...}: {
  nps.stacks.wg-portal = {
    enable = true;

    port = 51825;
    settings = {
      advanved.use_ip_v6 = false;
      core = {
        admin_user = "admin";
        # Read admin password from env variable 'ADMIN_PASSWORD'
        admin_password = "\${ADMIN_PASSWORD}";
      };
    };
    # Provide the admin password env variable
    extraEnv.ADMIN_PASSWORD.fromFile = config.sops.secrets."wg-portal/admin_password".path;

    oidc = {
      enable = true;
      clientSecretFile = config.sops.secrets."wg-portal/authelia/client_secret".path;
      clientSecretHash = "$pbkdf2-sha512$...";
    };
  };
}

Stack Options

nps.stacks.wg-portal.containers.wg-portal

Alias of {option}services.podman.containers.wg-portal.

Type
plaintext
submodule
Declaration

nps.stacks.wg-portal.enable

Whether to enable wg-portal.

Type
plaintext
boolean
Default
nix
false
Example
nix
true
Declaration

nps.stacks.wg-portal.extraEnv

Extra environment variables to set for the container. Variables can be either set directly or sourced from a file (e.g. for secrets).

Can be used to pass secrets or other environment variables that are referenced in the settings.

Type
plaintext
attribute set of (null or boolean or signed integer or string or absolute path or (submodule))
Default
nix
{ }
Example
nix
{
  ADMIN_PASSWORD = {
    fromFile = "/run/secrets/secret_name";
  };
}
Declaration

nps.stacks.wg-portal.oidc.adminGroup

Users of this group will be assigned admin rights

Type
plaintext
string
Default
nix
"wg-portal_admin"
Declaration

nps.stacks.wg-portal.oidc.clientSecretFile

The file containing the client secret for the OIDC client that will be registered in Authelia.

For examples on how to generate a client secret, see

https://www.authelia.com/integration/openid-connect/frequently-asked-questions/#client-secret

Type
plaintext
string
Example
nix
config.sops.secrets."immich/authelia/client_secret".path"
Declaration

nps.stacks.wg-portal.oidc.clientSecretHash

The client secret hash. For examples on how to generate a client secret, see https://www.authelia.com/integration/openid-connect/frequently-asked-questions/#client-secret

The value can be passed in multiple ways:

  1. As a literal string
  2. As an absolute path to a file containing the hash (toFile)
  3. As an absolute oath to a file containing the client_secret, in which case the hash will be automatically computed (toHash)
  4. As null

If left unset (null), the client secret will be read from the file specified in the clientSecretFile option and hashed automatically before being passed to the Authelia container.

Type
plaintext
null or string or (submodule)
Default
nix
null
Example
nix
# Literal String:
"$pbkdf2-sha512$310000$cbOAIWbfz3vCVXIPIp6d2A$J0klwULa6TvPRCU1HAfuKua/dMKTl8gbTYJz2N73ejGUu0LUGz/y3kwmJLuKuAYGg3WQOT0q9ZzVHHUvpKpgvQ"

# Client secret hash stored in a file
{ fromFile = config.sops.secrets."immich/client_secret_hash".path; }

# Client secret stored in a file: Hash will be computed dynamically
{ toHash = config.sops.secrets."immich/client_secret".path; }

# Null (default): Hash will be computed automatically based on the clientSecretFile option
# Equivalent to { toHash = cfg.oidc.clientSecretFile; }
null
Declaration

nps.stacks.wg-portal.oidc.enable

Whether to enable OIDC login with Authelia. This will register an OIDC client in Authelia and setup the necessary configuration.

For details, see:

Type
plaintext
boolean
Default
nix
false
Declaration

nps.stacks.wg-portal.oidc.userGroup

Users of this group will be able to log in

Type
plaintext
string
Default
nix
"wg-portal_user"
Declaration

nps.stacks.wg-portal.port

The default port for the first Wireguard interface that will be set up in the UI. Will be exposed and passed as the 'start_listen_port' setting in the configuration.

Type
plaintext
16 bit unsigned integer; between 0 and 65535 (both inclusive)
Default
nix
51820
Declaration

nps.stacks.wg-portal.settings

Settings for the wg-portal container. Will be converted to YAML and passed to the container.

See https://wgportal.org/latest/documentation/configuration/overview/

Type
plaintext
YAML 1.1 value
Example
nix
{
  core = {
    admin = {
      password = "\${ADMIN_PASSWORD}";
      username = "admin";
    };
  };
}
Declaration