feat(configuration): Make /etc/resolv.conf immutable

This commit is contained in:
Vincent Ambo 2018-05-25 10:47:56 +02:00
parent 1c8d158718
commit 7c01f06554

View file

@ -2,7 +2,7 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
imports = imports =
@ -39,6 +39,15 @@
firewall.allowedTCPPorts = [ 5556 5558 ]; 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: # Configure emacs:
# (actually, that's a lie, this only installs emacs!) # (actually, that's a lie, this only installs emacs!)
services.emacs = { services.emacs = {