nixpkgs icon indicating copy to clipboard operation
nixpkgs copied to clipboard

nixos/mpd: cannot configure VPN based auth without emitting warnings

Open hyperparabolic opened this issue 10 months ago • 3 comments

Nixpkgs version

  • Unstable (26.05)

Describe the bug

The warning emitted by the introduction of the openFirewall option is a very nice gesture, but if you use network isolation as an auth mechanism for your mpd server, it's impossible to configure your system without emitting warning this warning

Blocking access on the primary network interface is the entire point if you're set up this way. It isn't an exception or unwanted behavior. If you use abort-on-warn in your nix config then you can't build this config at all anymore.

It would be nice if either:

  • this warning was removed
  • there was some mechanism to suppress this warning

Happy to make either of these changes as well if you'll review it.

Steps to reproduce

services.mpd.settings = {
  # configure mpd to listen on 0.0.0.0, or an isolated network interface like a VPN or VLAN interface
  bind_to_address = "0.0.0.0";
  port = 6600;
};
# only open the firewall on a specific interface
networking.firewall.interfaces."anyNonDefaultInterface0".allowedTCPPorts = [config.services.mpd.settings.port];

Expected behaviour

Don't emit a warning for configs that work as intended, or provide a way to suppress this warning

Screenshots

No response

Relevant log output

building the system configuration...
evaluation warning: Using '0.0.0.0' as services.mpd.settings.bind_to_address without enabling services.mpd.openFirewall, might prevent you from accessing MPD from other clients.
error:
       … while calling the 'head' builtin
         at /nix/store/m6ji2a8jp7w4ck7vvrjh4grs4p3n7r26-source/lib/attrsets.nix:1713:13:
         1712|           if length values == 1 || pred here (elemAt values 1) (head values) then
         1713|             head values
             |             ^
         1714|           else

       … while evaluating the attribute 'value'
         at /nix/store/m6ji2a8jp7w4ck7vvrjh4grs4p3n7r26-source/lib/modules.nix:1118:7:
         1117|     // {
         1118|       value = addErrorContext "while evaluating the option `${showOption loc}':" value;
             |       ^
         1119|       inherit (res.defsFinal') highestPrio;

       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/store/m6ji2a8jp7w4ck7vvrjh4grs4p3n7r26-source/nixos/modules/system/activation/top-level.nix':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: aborting to reveal stack trace of warning, as abort-on-warn is set
Command 'nix --extra-experimental-features 'nix-command flakes' build --print-out-paths '.#nixosConfigurations."redbud".config.system.build.toplevel' --no-link' returned non-zero exit status 1.

Additional context

No response

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.12.66, NixOS, 26.05 (Yarara), 26.05.20260121.88d3861
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.31.3
  • nixpkgs: /nix/store/m6ji2a8jp7w4ck7vvrjh4grs4p3n7r26-source

Notify maintainers

@doronbehar


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a :+1: reaction to issues you find important.

hyperparabolic avatar Jan 29 '26 00:01 hyperparabolic

Please do open a PR. Suppressing this warning, or even better, checking for this exact VM setup, would be very welcome.

SigmaSquadron avatar Jan 29 '26 06:01 SigmaSquadron

Please tell me what do you think of this:

  • https://github.com/NixOS/nixpkgs/pull/484995

doronbehar avatar Jan 29 '26 08:01 doronbehar

Please tell me what do you think of this:

* [nixos/mpd: allow to explicitly close firewall without a warning #484995](https://github.com/NixOS/nixpkgs/pull/484995)

Yeah, that looks fine. Thanks!

hyperparabolic avatar Jan 29 '26 20:01 hyperparabolic