2017-12-03 10:41:22 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2022-06-01 20:20:16 +00:00
|
|
|
cfg = config.services.localtimed;
|
2017-12-03 10:41:22 +00:00
|
|
|
in {
|
2022-06-08 13:46:26 +00:00
|
|
|
imports = [ (lib.mkRenamedOptionModule [ "services" "localtime" ] [ "services" "localtimed" ]) ];
|
|
|
|
|
2017-12-03 10:41:22 +00:00
|
|
|
options = {
|
2022-06-01 20:20:16 +00:00
|
|
|
services.localtimed = {
|
2017-12-03 10:41:22 +00:00
|
|
|
enable = mkOption {
|
2020-04-20 18:05:26 +00:00
|
|
|
type = types.bool;
|
2017-12-03 10:41:22 +00:00
|
|
|
default = false;
|
|
|
|
description = ''
|
2022-06-01 20:20:16 +00:00
|
|
|
Enable <literal>localtimed</literal>, a simple daemon for keeping the
|
|
|
|
system timezone up-to-date based on the current location. It uses
|
|
|
|
geoclue2 to determine the current location.
|
2017-12-03 10:41:22 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-06-01 20:20:16 +00:00
|
|
|
services.geoclue2.appConfig.localtimed = {
|
|
|
|
isAllowed = true;
|
|
|
|
isSystem = true;
|
2019-06-03 17:01:30 +00:00
|
|
|
};
|
2017-12-03 10:41:22 +00:00
|
|
|
|
2019-06-16 11:21:20 +00:00
|
|
|
# Install the polkit rules.
|
2021-02-09 17:21:14 +00:00
|
|
|
environment.systemPackages = [ pkgs.localtime ];
|
2019-06-16 11:21:20 +00:00
|
|
|
# Install the systemd unit.
|
2021-02-09 17:21:14 +00:00
|
|
|
systemd.packages = [ pkgs.localtime ];
|
2017-12-03 10:41:22 +00:00
|
|
|
|
2022-06-01 20:20:16 +00:00
|
|
|
systemd.services.localtime.wantedBy = [ "multi-user.target" ];
|
2017-12-03 10:41:22 +00:00
|
|
|
};
|
|
|
|
}
|