summary refs log tree commit diff
path: root/nixos/modules/system/boot/timesyncd.nix
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-04-19 21:05:12 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-04-19 22:06:45 +0200
commitf8dbe5f376978947067283c6d03087d7948c50de (patch)
tree3f30d63876a57c77bf069ed3c6eb36d26a00ea3f /nixos/modules/system/boot/timesyncd.nix
parent88fa30e8f293f3a896366e305888f9f05cc178e7 (diff)
downloadnixpkgs-f8dbe5f376978947067283c6d03087d7948c50de.tar
nixpkgs-f8dbe5f376978947067283c6d03087d7948c50de.tar.gz
nixpkgs-f8dbe5f376978947067283c6d03087d7948c50de.tar.bz2
nixpkgs-f8dbe5f376978947067283c6d03087d7948c50de.tar.lz
nixpkgs-f8dbe5f376978947067283c6d03087d7948c50de.tar.xz
nixpkgs-f8dbe5f376978947067283c6d03087d7948c50de.tar.zst
nixpkgs-f8dbe5f376978947067283c6d03087d7948c50de.zip
systemd: Move networkd into separate modules
The systemd module was getting rather bloated.
Diffstat (limited to 'nixos/modules/system/boot/timesyncd.nix')
-rw-r--r--nixos/modules/system/boot/timesyncd.nix38
1 files changed, 38 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/timesyncd.nix b/nixos/modules/system/boot/timesyncd.nix
new file mode 100644
index 00000000000..fd4be47ad72
--- /dev/null
+++ b/nixos/modules/system/boot/timesyncd.nix
@@ -0,0 +1,38 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+{
+
+  options = {
+
+    services.timesyncd.enable = mkOption {
+      default = false;
+      type = types.bool;
+      description = ''
+        Enables the systemd NTP client daemon.
+      '';
+    };
+
+  };
+
+  config = mkIf config.services.timesyncd.enable {
+
+    systemd.services.systemd-timesyncd = {
+      wantedBy = [ "sysinit.target" ];
+      restartTriggers = [ config.environment.etc."systemd/timesyncd.conf".source ];
+    };
+
+    environment.etc."systemd/timesyncd.conf".text = ''
+      [Time]
+      NTP=${concatStringsSep " " config.services.ntp.servers}
+    '';
+
+    systemd.services.ntpd.enable = false;
+
+    users.extraUsers.systemd-timesync.uid = config.ids.uids.systemd-timesync;
+    users.extraGroups.systemd-timesync.gid = config.ids.gids.systemd-timesync;
+
+  };
+
+}