Unverified Commit 48e839c8 authored by Michele Guerini Rocco's avatar Michele Guerini Rocco Committed by GitHub
Browse files

nixos/pdns-recursor: remove old-settings (#482370)

parents 593c49af e075f892
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -275,11 +275,11 @@ Alongside many enhancements to NixOS modules and general system improvements, th
  and thus doesn't qualify as default.

- PowerDNS Recursor has been updated to version 5.1.2, which comes with a new YAML configuration format (`recursor.yml`)
  and deprecates the previous format (`recursor.conf`). Accordingly, the NixOS option `services.pdns-recursor.settings`
  has been renamed to [old-settings](#opt-services.pdns-recursor.old-settings) and will be provided for backward compatibility
  until the next NixOS release. Users are asked to migrate their settings to the new [yaml-settings](#opt-services.pdns-recursor.old-settings)
  and deprecates the previous format (`recursor.conf`). Accordingly, the NixOS option {option}`services.pdns-recursor.settings`
  has been renamed to `old-settings` and will be provided for backward compatibility
  until the next NixOS release. Users are asked to migrate their settings to the new `yaml-settings`.
  option following this [guide](https://doc.powerdns.com/recursor/appendices/yamlconversion.html).
  Note that options other than `services.pdns-recursor.settings` are unaffacted by this change.
  Note that options other than {option}`services.pdns-recursor.settings` are unaffacted by this change.

- The `virtualisation.hypervGuest.videoMode` option has been removed. Standard tooling can now be used to configure display modes for Hyper-V VMs.

+2 −0
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ of pulling the upstream container image from Docker Hub. If you want the old beh

- `pdns` has been updated to version [v5.0.x](https://doc.powerdns.com/authoritative/changelog/5.0.html), which introduces breaking changes. Check out the [Upgrade Notes](https://doc.powerdns.com/authoritative/upgrading.html#to-5-0-0) for details.

- In the PowerDNS Recursor module, following the deprecation period started with NixOS 25.05, the option {option}`services.pdns-recursor.old-settings` has been removed and {option}`services.pdns-recursor.yaml-settings` consequently renamed to [](#opt-services.pdns-recursor.settings).

- `services.angrr` now uses TOML for configuration. Define policies with `services.angrr.settings` (generate TOML file) or point to a file using `services.angrr.configFile`. The legacy options `services.angrr.period`, `services.angrr.ownedOnly`, and `services.angrr.removeRoot` have been removed. See `man 5 angrr` and the description of `services.angrr.settings` options for examples and details.

- `services.pingvin-share` has been removed as the `pingvin-share.backend` package was broken and the project was archived upstream.
+20 −52
Original line number Diff line number Diff line
@@ -48,23 +48,6 @@ let
    }
  );

  configFile =
    if cfg.old-settings != { } then
      # Convert recursor.conf to recursor.yml and merge it
      let
        conf = pkgs.writeText "recursor.conf" (
          concatStringsSep "\n" (mapAttrsToList (name: val: "${name}=${serialize val}") cfg.old-settings)
        );

        yaml = settingsFormat.generate "recursor.yml" cfg.yaml-settings;
      in
      pkgs.runCommand "recursor-merged.yml" { } ''
        ${pkgs.pdns-recursor}/bin/rec_control show-yaml --config ${conf} > override.yml
        ${pkgs.yq-go}/bin/yq '. *= load("override.yml")' ${yaml} > $out
      ''
    else
      settingsFormat.generate "recursor.yml" cfg.yaml-settings;

in
{
  options.services.pdns-recursor = {
@@ -196,30 +179,7 @@ in
      '';
    };

    old-settings = mkOption {
      type = configType;
      default = { };
      example = literalExpression ''
        {
          loglevel = 8;
          log-common-errors = true;
        }
      '';
      description = ''
        Older PowerDNS Recursor settings. Use this option to configure
        Recursor settings not exposed in a NixOS option or to bypass one.
        See the full documentation at
        <https://doc.powerdns.com/recursor/settings.html>
        for the available options.

        ::: {.warning}
        This option is provided for backward compatibility only
        and will be removed in the next release of NixOS.
        :::
      '';
    };

    yaml-settings = mkOption {
    settings = mkOption {
      type = settingsFormat.type;
      default = { };
      example = literalExpression ''
@@ -249,11 +209,12 @@ in

  config = mkIf cfg.enable {

    environment.etc."/pdns-recursor/recursor.yml".source = configFile;
    environment.etc."/pdns-recursor/recursor.yml".source =
      settingsFormat.generate "recursor.yml" cfg.settings;

    networking.resolvconf.useLocalResolver = lib.mkDefault true;

    services.pdns-recursor.yaml-settings = {
    services.pdns-recursor.settings = {
      incoming = mkDefaultAttrs {
        listen = cfg.dns.address;
        port = cfg.dns.port;
@@ -301,15 +262,6 @@ in

    users.groups.pdns-recursor = { };

    warnings = lib.optional (cfg.old-settings != { }) ''
      pdns-recursor has changed its configuration file format from pdns-recursor.conf
      (mapped to `services.pdns-recursor.old-settings`) to the newer pdns-recursor.yml
      (mapped to `services.pdns-recursor.yaml-settings`).

      Support for the older format will be removed in a future version, so please migrate
      your settings over. See <https://doc.powerdns.com/recursor/yamlsettings.html>.
    '';

  };

  imports = [
@@ -320,16 +272,32 @@ in
    ] "To change extra Recursor settings use services.pdns-recursor.settings instead.")

    (mkRenamedOptionModule
      [
        "services"
        "pdns-recursor"
        "yaml-settings"
      ]
      [
        "services"
        "pdns-recursor"
        "settings"
      ]
    )

    (mkRemovedOptionModule
      [
        "services"
        "pdns-recursor"
        "old-settings"
      ]
      ''
        pdns-recursor has changed its configuration file format from pdns-recursor.conf
        (mapped to `services.pdns-recursor.old-settings`) to the newer pdns-recursor.yml
        (mapped to `services.pdns-recursor.settings`).

        Support for the older format has been removed, please migrate your settings over.
        See <https://doc.powerdns.com/recursor/yamlsettings.html>.
      ''
    )
  ];

+0 −4
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@
  nodes.server = {
    services.pdns-recursor.enable = true;
    services.pdns-recursor.exportHosts = true;
    services.pdns-recursor.old-settings.dnssec-log-bogus = true;
    networking.hosts."192.0.2.1" = [ "example.com" ];
  };

@@ -18,8 +17,5 @@

    with subtest("can resolve names"):
      assert "192.0.2.1" in server.succeed("host example.com localhost")

    with subtest("old-settings have been merged in"):
      server.succeed("${lib.getExe pkgs.yq-go} -e .dnssec.log_bogus /etc/pdns-recursor/recursor.yml")
  '';
}