about summary refs log tree commit diff
path: root/configuration.nix
diff options
context:
space:
mode:
Diffstat (limited to 'configuration.nix')
-rw-r--r--configuration.nix11
1 files changed, 10 insertions, 1 deletions
diff --git a/configuration.nix b/configuration.nix
index 08043924c1fd..de8fcdd395ff 100644
--- a/configuration.nix
+++ b/configuration.nix
@@ -2,7 +2,7 @@
 # your system.  Help is available in the configuration.nix(5) man page
 # and in the NixOS manual (accessible by running ‘nixos-help’).
 
-{ config, pkgs, ... }:
+{ config, lib, pkgs, ... }:
 
 {
   imports =
@@ -39,6 +39,15 @@
     firewall.allowedTCPPorts = [ 5556 5558 ];
   };
 
+  # Generate an immutable /etc/resolv.conf from the nameserver settings
+  # above (otherwise DHCP overwrites it):
+  environment.etc."resolv.conf" = with lib; with pkgs; {
+    source = writeText "resolv.conf" ''
+      ${concatStringsSep "\n" (map (ns: "nameserver ${ns}") config.networking.nameservers)}
+      options edns0
+    '';
+  };
+
   # Configure emacs:
   # (actually, that's a lie, this only installs emacs!)
   services.emacs = {