3
0
Fork 0
forked from mirrors/nixpkgs

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; with lib;
let let
cfg = config.services.localtime; cfg = config.services.localtimed;
in { in {
options = { options = {
services.localtime = { services.localtimed = {
enable = mkOption { enable = mkOption {
type = types.bool; type = types.bool;
default = false; default = false;
description = '' description = ''
Enable <literal>localtime</literal>, simple daemon for keeping the system Enable <literal>localtimed</literal>, a simple daemon for keeping the
timezone up-to-date based on the current location. It uses geoclue2 to system timezone up-to-date based on the current location. It uses
determine the current location and systemd-timedated to actually set geoclue2 to determine the current location.
the timezone.
''; '';
}; };
}; };
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
services.geoclue2 = { services.geoclue2.appConfig.localtimed = {
enable = true; isAllowed = true;
appConfig.localtime = { isSystem = true;
isAllowed = true;
isSystem = true;
};
}; };
# Install the polkit rules. # Install the polkit rules.
@ -34,16 +30,6 @@ in {
# Install the systemd unit. # Install the systemd unit.
systemd.packages = [ pkgs.localtime ]; systemd.packages = [ pkgs.localtime ];
users.users.localtimed = { systemd.services.localtime.wantedBy = [ "multi-user.target" ];
description = "localtime daemon";
isSystemUser = true;
group = "localtimed";
};
users.groups.localtimed = {};
systemd.services.localtime = {
wantedBy = [ "multi-user.target" ];
serviceConfig.Restart = "on-failure";
};
}; };
} }

View file

@ -1,6 +1,5 @@
{ buildGoModule { buildGoModule
, fetchFromGitHub , fetchFromGitHub
, geoclue2-with-demo-agent
, lib , lib
, m4 , m4
}: }:
@ -18,11 +17,6 @@ buildGoModule {
vendorSha256 = "sha256-12JnEU41sp9qRP07p502EYogveE+aNdfmLwlDRbIdxU="; 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 ]; nativeBuildInputs = [ m4 ];
installPhase = '' installPhase = ''