diff options
author | Vincent Ambo <mail@tazj.in> | 2018-05-25T08·47+0200 |
---|---|---|
committer | Vincent Ambo <mail@tazj.in> | 2018-05-27T18·13+0200 |
commit | 7c01f06554b59b035c383dda08113f8d9ba52130 (patch) | |
tree | 82c5adb69d2ea39c46a338087a265ea337b1562b /configuration.nix | |
parent | 1c8d15871860f47f0ad54c2fafb38f582a3b73ff (diff) |
feat(configuration): Make /etc/resolv.conf immutable
Diffstat (limited to 'configuration.nix')
-rw-r--r-- | configuration.nix | 11 |
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 = { |