2017-12-03 10:41:22 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.localtime;
|
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
services.localtime = {
|
|
|
|
enable = mkOption {
|
2020-04-20 19:05:26 +01:00
|
|
|
type = types.bool;
|
2017-12-03 10:41:22 +00: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 18:01:30 +01:00
|
|
|
services.geoclue2 = {
|
|
|
|
enable = true;
|
2019-08-13 22:52:01 +01:00
|
|
|
appConfig.localtime = {
|
2019-06-03 18:01:30 +01:00
|
|
|
isAllowed = true;
|
|
|
|
isSystem = true;
|
|
|
|
};
|
|
|
|
};
|
2017-12-03 10:41:22 +00:00
|
|
|
|
2019-06-16 12:21:20 +01: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 10:41:22 +00:00
|
|
|
|
2019-09-14 18:51:29 +01:00
|
|
|
users.users.localtimed = {
|
|
|
|
description = "Taskserver user";
|
|
|
|
};
|
|
|
|
|
2017-12-03 10:41:22 +00:00
|
|
|
systemd.services.localtime = {
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
2019-06-16 12:21:20 +01:00
|
|
|
serviceConfig.Restart = "on-failure";
|
2017-12-03 10:41:22 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|