nixos/localtimed: hopefully fix geoclue

This commit is contained in:
Bernardo Meurer 2022-06-01 13:20:16 -07:00
parent ccad9f83bc
commit ffae8569b0
2 changed files with 9 additions and 29 deletions

View file

@ -3,30 +3,26 @@
with lib;
let
cfg = config.services.localtime;
cfg = config.services.localtimed;
in {
options = {
services.localtime = {
services.localtimed = {
enable = mkOption {
type = types.bool;
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.
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.
'';
};
};
};
config = mkIf cfg.enable {
services.geoclue2 = {
enable = true;
appConfig.localtime = {
isAllowed = true;
isSystem = true;
};
services.geoclue2.appConfig.localtimed = {
isAllowed = true;
isSystem = true;
};
# Install the polkit rules.
@ -34,16 +30,6 @@ in {
# Install the systemd unit.
systemd.packages = [ pkgs.localtime ];
users.users.localtimed = {
description = "localtime daemon";
isSystemUser = true;
group = "localtimed";
};
users.groups.localtimed = {};
systemd.services.localtime = {
wantedBy = [ "multi-user.target" ];
serviceConfig.Restart = "on-failure";
};
systemd.services.localtime.wantedBy = [ "multi-user.target" ];
};
}

View file

@ -1,6 +1,5 @@
{ buildGoModule
, fetchFromGitHub
, geoclue2-with-demo-agent
, lib
, m4
}:
@ -18,11 +17,6 @@ buildGoModule {
vendorSha256 = "sha256-12JnEU41sp9qRP07p502EYogveE+aNdfmLwlDRbIdxU=";
postPatch = ''
demoPath="${geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/agent"
sed -i localtimed.go -e "s#/usr/lib/geoclue-2.0/demos/agent#$demoPath#"
'';
nativeBuildInputs = [ m4 ];
installPhase = ''