summary refs log tree commit diff
path: root/nixos/modules/system/boot/resolved.nix
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2015-05-05 11:49:03 +0200
committerVladimír Čunát <vcunat@gmail.com>2015-05-05 11:49:03 +0200
commit375bc8def7c17506bc10f3b6193635f05d5ccc40 (patch)
tree6af7662b245e7998bd18ae20d9e74922c489fb6d /nixos/modules/system/boot/resolved.nix
parent2f75c6845981b38a698cf1a9f620145877c80956 (diff)
parent7f9ccc628403ed88844a4436da3b2944be5560a4 (diff)
downloadnixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar
nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.gz
nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.bz2
nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.lz
nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.xz
nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.tar.zst
nixpkgs-375bc8def7c17506bc10f3b6193635f05d5ccc40.zip
Merge staging into closure-size
Diffstat (limited to 'nixos/modules/system/boot/resolved.nix')
-rw-r--r--nixos/modules/system/boot/resolved.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/resolved.nix b/nixos/modules/system/boot/resolved.nix
new file mode 100644
index 00000000000..ecd547322d3
--- /dev/null
+++ b/nixos/modules/system/boot/resolved.nix
@@ -0,0 +1,38 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+  options = {
+
+    services.resolved.enable = mkOption {
+      default = false;
+      type = types.bool;
+      description = ''
+        Whether to enable the systemd DNS resolver daemon.
+      '';
+    };
+
+  };
+
+  config = mkIf config.services.resolved.enable {
+
+    systemd.additionalUpstreamSystemUnits = [ "systemd-resolved.service" ];
+
+    systemd.services.systemd-resolved = {
+      wantedBy = [ "multi-user.target" ];
+      restartTriggers = [ config.environment.etc."systemd/resolved.conf".source ];
+    };
+
+    environment.etc."systemd/resolved.conf".text = ''
+      [Resolve]
+      DNS=${concatStringsSep " " config.networking.nameservers}
+    '';
+
+    users.extraUsers.systemd-resolve.uid = config.ids.uids.systemd-resolve;
+    users.extraGroups.systemd-resolve.gid = config.ids.gids.systemd-resolve;
+
+  };
+
+}