2020-04-24 23:36:52 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2022-06-16 17:23:12 +00:00
|
|
|
cfg = config.services.localtimed;
|
2020-04-24 23:36:52 +00:00
|
|
|
in {
|
2022-06-16 17:23:12 +00:00
|
|
|
imports = [ (lib.mkRenamedOptionModule [ "services" "localtime" ] [ "services" "localtimed" ]) ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
options = {
|
2022-06-16 17:23:12 +00:00
|
|
|
services.localtimed = {
|
2020-04-24 23:36:52 +00:00
|
|
|
enable = mkOption {
|
|
|
|
type = types.bool;
|
|
|
|
default = false;
|
2022-08-12 12:06:08 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Enable `localtimed`, a simple daemon for keeping the
|
2022-06-16 17:23:12 +00:00
|
|
|
system timezone up-to-date based on the current location. It uses
|
|
|
|
geoclue2 to determine the current location.
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2022-06-16 17:23:12 +00:00
|
|
|
services.geoclue2.appConfig.localtimed = {
|
|
|
|
isAllowed = true;
|
|
|
|
isSystem = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# Install the polkit rules.
|
2021-03-19 17:17:44 +00:00
|
|
|
environment.systemPackages = [ pkgs.localtime ];
|
2020-04-24 23:36:52 +00:00
|
|
|
# Install the systemd unit.
|
2021-03-19 17:17:44 +00:00
|
|
|
systemd.packages = [ pkgs.localtime ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-06-16 17:23:12 +00:00
|
|
|
systemd.services.localtime.wantedBy = [ "multi-user.target" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|