2017-12-03 11:41:22 +01:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.localtime;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.localtime = {
|
|
|
|
enable = mkOption {
|
2020-04-20 20:05:26 +02:00
|
|
|
type = types.bool;
|
2017-12-03 11:41:22 +01:00
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Enable <literal>localtime</literal>, simple daemon for keeping the system
|
|
|
|
timezone up-to-date based on the current location. It uses geoclue2 to
|
|
|
|
determine the current location and systemd-timedated to actually set
|
|
|
|
the timezone.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2019-06-03 19:01:30 +02:00
|
|
|
services.geoclue2 = {
|
|
|
|
enable = true;
|
2019-08-13 23:52:01 +02:00
|
|
|
appConfig.localtime = {
|
2019-06-03 19:01:30 +02:00
|
|
|
isAllowed = true;
|
|
|
|
isSystem = true;
|
|
|
|
};
|
|
|
|
};
|
2017-12-03 11:41:22 +01:00
|
|
|
|
2019-06-16 13:21:20 +02:00
|
|
|
# We use the 'out' output, since localtime has its 'bin' output
|
|
|
|
# first, so that is what we get if we use the derivation bare.
|
|
|
|
# Install the polkit rules.
|
|
|
|
environment.systemPackages = [ pkgs.localtime.out ];
|
|
|
|
# Install the systemd unit.
|
|
|
|
systemd.packages = [ pkgs.localtime.out ];
|
2017-12-03 11:41:22 +01:00
|
|
|
|
2019-09-14 19:51:29 +02:00
|
|
|
users.users.localtimed = {
|
|
|
|
description = "Taskserver user";
|
|
|
|
};
|
|
|
|
|
2017-12-03 11:41:22 +01:00
|
|
|
systemd.services.localtime = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2019-06-16 13:21:20 +02:00
|
|
|
serviceConfig.Restart = "on-failure";
|
2017-12-03 11:41:22 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|