Sample Header Ad - 728x90

Conflicting settings value for Nixos service when defined within Nixos declarative containers

0 votes
1 answer
84 views
Within my nixos config I have a container defined:
containers.finderdbreplica = {
    config = { config, pkgs, ... }:
    {
      services.postgresql = {
    ...
services.postgresql = {
        enable = true;
        port = 5548;
        package = pkgs.postgresql_11;
        authentication = pkgs.lib.mkOverride 10 ''
          local all all trust
          host all all ::1/128 trust
          host    all     all             127.0.0.1/32            trust
        '';

        settings = {
          log_statement = "all";
        };

        enableTCPIP = true;

        initialScript = pkgs.writeText "backend-initScript" ''
          ALTER USER postgres WITH PASSWORD 'mysecretpassword';
        '';
      };
When trying to set a log prefix with:
settings = {
          log_statement = "all";
          log_line_prefix = "[%p] %a %u";
        };
I'm getting an error of error: The option `containers.finderdbreplica.services.postgresql.settings.log_line_prefix' has conflicting definition values: - In `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/virtualisation/nixos-containers.nix': "[%p] %a %u" - In `/nix/store/w1iy7m8zla5b8mlwkabs1cxf542s5f5y-nixos-22.05/nixos/nixos/modules/services/databases/postgresql.nix': "[%p] " (use '--show-trace' to show detailed location information) I can instead set services.postgresql.settings.log_line_prefix = "[%p] %a %u"; outside of the container, however this does not seem to apply to the services within the containers. Is this a limitation? Is there some other way to set the settings for a container service?
Asked by Chris Stryczynski (6603 rep)
Jul 9, 2024, 05:41 PM
Last activity: Jul 9, 2024, 06:07 PM