From 2000a1edcd0e02a114042081632ed87b4cc55031 Mon Sep 17 00:00:00 2001 From: pennae Date: Sat, 11 Dec 2021 14:42:06 +0100 Subject: [PATCH] nixos/unifi: add deprecation warning for openPorts modules are discouraged from opening ports in the firewall unless explicitly told to do so. add a deprecation notice for this in unifi. --- .../doc/manual/from_md/release-notes/rl-2205.section.xml | 8 ++++++++ nixos/doc/manual/release-notes/rl-2205.section.md | 3 +++ nixos/modules/services/networking/unifi.nix | 6 +++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml index f0da210f6580..716b91c3c536 100644 --- a/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml +++ b/nixos/doc/manual/from_md/release-notes/rl-2205.section.xml @@ -159,6 +159,14 @@ compatibilty, but will be removed at a later date. + + + The services.unifi.openPorts option default + value of true is now deprecated and will be + changed to false in 22.11. Configurations + using this default will print a warning when rebuilt. + + diff --git a/nixos/doc/manual/release-notes/rl-2205.section.md b/nixos/doc/manual/release-notes/rl-2205.section.md index 2c008a67dd72..7610cfb732d8 100644 --- a/nixos/doc/manual/release-notes/rl-2205.section.md +++ b/nixos/doc/manual/release-notes/rl-2205.section.md @@ -65,3 +65,6 @@ In addition to numerous new and upgraded packages, this release has the followin `influxdb2-cli`, matching the split that took place upstream. A combined `influxdb2` package is still provided in this release for backwards compatibilty, but will be removed at a later date. + +- The `services.unifi.openPorts` option default value of `true` is now deprecated and will be changed to `false` in 22.11. + Configurations using this default will print a warning when rebuilt. diff --git a/nixos/modules/services/networking/unifi.nix b/nixos/modules/services/networking/unifi.nix index 174e919f988b..9750231e6034 100644 --- a/nixos/modules/services/networking/unifi.nix +++ b/nixos/modules/services/networking/unifi.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, utils, ... }: +{ config, options, lib, pkgs, utils, ... }: with lib; let cfg = config.services.unifi; @@ -86,6 +86,10 @@ in config = mkIf cfg.enable { + warnings = optional + (options.services.unifi.openPorts.highestPrio >= (mkOptionDefault null).priority) + "The current services.unifi.openPorts = true default is deprecated and will change to false in 22.11. Set it explicitly to silence this warning."; + users.users.unifi = { isSystemUser = true; group = "unifi";