From 5b94e6b86fe012cb969cb1e3ff22573756f5349c Mon Sep 17 00:00:00 2001 From: nzbr Date: Wed, 9 Nov 2022 05:54:06 +0100 Subject: [PATCH] fix: warnings --- modules/wsl-distro.nix | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/wsl-distro.nix b/modules/wsl-distro.nix index 0b480a6f..e63704a4 100644 --- a/modules/wsl-distro.nix +++ b/modules/wsl-distro.nix @@ -130,9 +130,17 @@ with lib; { # Start a systemd user session when starting a command through runuser security.pam.services.runuser.startSession = true; - warnings = (optional (config.systemd.services.systemd-resolved.enable && config.wsl.wslConf.network.generateResolvConf) - "systemd-resolved is enabled, but resolv.conf is managed by WSL" - ); + warnings = flatten [ + (optional (config.services.resolved.enable && config.wsl.wslConf.network.generateResolvConf) + "systemd-resolved is enabled, but resolv.conf is managed by WSL" + ) + (optional ((length config.networking.nameservers) > 0 && config.wsl.wslConf.network.generateResolvConf) + "custom nameservers are set, but resolv.conf is managed by WSL" + ) + (optional ((length config.networking.nameservers) == 0 && !config.services.resolved.enable && !config.wsl.wslConf.network.generateResolvConf) + "resolv.conf generation is turned off, but no other nameservers are configured" + ) + ]; } (mkIf (!cfg.nativeSystemd) { users.users.root.shell = "${syschdemd}/bin/syschdemd";