Networking.networkmanager.settings

Hello, I have switched from stable to unstable and am sorting out the changes to the configuration syntax. One issue is the change from extraConfig to settings for network manager. I cannot for the life of me convert my previous extra config to the new format. Previous way:

extraConfig = ''
      [connection]
      ipv6.addr-gen-mode=stable-privacy
      ipv6.ip6-privacy=2
    '';

Gives the error that the option was replaced but then seemingly erroneously uses the defunct option in the example:

- The option definition `networking.networkmanager.extraConfig' in `/etc/nixos/configuration.nix' no longer has any effect; please remove it.
       This option was removed in favour of `networking.networkmanager.settings`,
       which accepts structured nix-code equivalent to the ini
       and allows for overriding settings.
       Example patch:
       ```patch
          networking.networkmanager = {
       -    extraConfig = ''
       -      [main]
       -      no-auto-default=*
       -    ''
       +    extraConfig.main.no-auto-default = "*";
          };
       ```

Taking their example and correcting it with the new settings option:

settings.connection.ipv6.addr-gen-mode = "stable-privacy";
settings.connection.ipv6.ip6-privacy = "2";

Results in the error:

error: A definition for option `networking.networkmanager.settings.connection.ipv6' is not of type `INI atom (null, bool, int, float or string)'. Definition values:
       - In `/etc/nixos/configuration.nix':
           {
             addr-gen-mode = "stable-privacy";
             ip6-privacy = "2";
           }

Sorry for the long post but I have tried every variation and format I could think of with no luck. What am I missing here?

Hey, I’m author of that change, and messed up in the pr, the example has now been updated.
The solution for your problem should be:

settings.connection."ipv6.addr-gen-mode" = "stable-privacy";
settings.connection."ipv6.ip6-privacy" = "2";

this is a bit finicky because the networkmanager option uses . as separator which is also the separator for nix attribute-sets.

2 Likes

Thanks for the reply. I was able to build with your example.