diff --git a/nixos/modules/config/networking.nix b/nixos/modules/config/networking.nix
index 25253cf02e1..8b352dad472 100644
--- a/nixos/modules/config/networking.nix
+++ b/nixos/modules/config/networking.nix
@@ -309,8 +309,11 @@ in
ln -s /run/systemd/resolve/resolv.conf /run/resolvconf/interfaces/systemd
''}
- # Make sure resolv.conf is up to date if not managed manually or by systemd
- ${optionalString (!config.environment.etc?"resolv.conf") ''
+ # Make sure resolv.conf is up to date if not managed manually, by systemd or
+ # by NetworkManager
+ ${optionalString (!config.environment.etc?"resolv.conf" &&
+ (cfg.networkmanager.enable ->
+ cfg.networkmanager.rc-manager == "resolvconf")) ''
${pkgs.openresolv}/bin/resolvconf -u
''}
'';
diff --git a/nixos/modules/services/networking/networkmanager.nix b/nixos/modules/services/networking/networkmanager.nix
index f1ba7dd4e4f..fa670b41116 100644
--- a/nixos/modules/services/networking/networkmanager.nix
+++ b/nixos/modules/services/networking/networkmanager.nix
@@ -17,6 +17,7 @@ let
plugins=keyfile
dhcp=${cfg.dhcp}
dns=${cfg.dns}
+ rc-manager=${cfg.rc-manager}
[keyfile]
${optionalString (cfg.unmanaged != [])
@@ -283,6 +284,25 @@ in {
'';
};
+ rc-manager = mkOption {
+ type = types.enum [ "symlink" "file" "resolvconf" "netconfig" "unmanaged" "none" ];
+ default = "resolvconf";
+ description = ''
+ Set the resolv.conf management mode.
+
+
+ A description of these modes can be found in the main section of
+
+ https://developer.gnome.org/NetworkManager/stable/NetworkManager.conf.html
+
+ or in
+
+ NetworkManager.conf
+ 5
+ .
+ '';
+ };
+
dispatcherScripts = mkOption {
type = types.listOf (types.submodule {
options = {