Skip to content

Commit

Permalink
nixos/dnsmasq: remove deprecated option "extraConfig"
Browse files Browse the repository at this point in the history
  • Loading branch information
rhoriguchi committed Sep 5, 2024
1 parent 8b16862 commit fa5b2a2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 24 deletions.
2 changes: 2 additions & 0 deletions nixos/doc/manual/release-notes/rl-2411.section.md
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@

- The `openlens` package got removed, suggested replacment `lens-desktop`

- The `services.dnsmasq.extraConfig` option has been removed, as it had been deprecated for over 2 years. This option is replaced by `services.dnsmasq.settings`.

## Other Notable Changes {#sec-release-24.11-notable-changes}

<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
Expand Down
22 changes: 2 additions & 20 deletions nixos/modules/services/networking/dnsmasq.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,15 @@ let
listsAsDuplicateKeys = true;
};

# Because formats.generate is outputting a file, we use of conf-file. Once
# `extraConfig` is deprecated we can just use
# `dnsmasqConf = format.generate "dnsmasq.conf" cfg.settings`
dnsmasqConf = pkgs.writeText "dnsmasq.conf" ''
conf-file=${settingsFormat.generate "dnsmasq.conf" cfg.settings}
${cfg.extraConfig}
'';
dnsmasqConf = settingsFormat.generate "dnsmasq.conf" cfg.settings;

in

{

imports = [
(mkRenamedOptionModule [ "services" "dnsmasq" "servers" ] [ "services" "dnsmasq" "settings" "server" ])
(mkRemovedOptionModule [ "services" "dnsmasq" "extraConfig" ] "This option is replaced by `services.dnsmasq.settings`")
];

###### interface
Expand Down Expand Up @@ -107,17 +102,6 @@ in
'';
};

extraConfig = mkOption {
type = types.lines;
default = "";
description = ''
Extra configuration directives that should be added to
`dnsmasq.conf`.
This option is deprecated, please use {option}`settings` instead.
'';
};

};

};
Expand All @@ -127,8 +111,6 @@ in

config = mkIf cfg.enable {

warnings = lib.optional (cfg.extraConfig != "") "Text based config is deprecated, dnsmasq now supports `services.dnsmasq.settings` for an attribute-set based config";

services.dnsmasq.settings = {
dhcp-leasefile = mkDefault "${stateDir}/dnsmasq.leases";
conf-file = mkDefault (optional cfg.resolveLocalQueries "/etc/dnsmasq-conf.conf");
Expand Down
8 changes: 4 additions & 4 deletions nixos/modules/services/networking/nixops-dns.nix
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ in
servers = [
"/${cfg.domain}/127.0.0.1#5300"
];
extraConfig = ''
bind-interfaces
listen-address=127.0.0.1
'';
settings = {
bind-interfaces = true;
listen-address = "127.0.0.1";
};
};

};
Expand Down

0 comments on commit fa5b2a2

Please sign in to comment.