nixos/localtimed: fix service

Changed files
+69 -38
nixos
modules
+2
nixos/modules/misc/ids.nix
···
webdav = 322;
pipewire = 323;
rstudio-server = 324;
+
localtimed = 325;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
···
webdav = 322;
pipewire = 323;
rstudio-server = 324;
+
localtimed = 325;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal
+1 -1
nixos/modules/module-list.nix
···
./services/system/cloud-init.nix
./services/system/dbus.nix
./services/system/earlyoom.nix
-
./services/system/localtime.nix
+
./services/system/localtimed.nix
./services/system/kerberos/default.nix
./services/system/nscd.nix
./services/system/saslauthd.nix
-37
nixos/modules/services/system/localtime.nix
···
-
{ config, lib, pkgs, ... }:
-
-
with lib;
-
-
let
-
cfg = config.services.localtimed;
-
in {
-
imports = [ (lib.mkRenamedOptionModule [ "services" "localtime" ] [ "services" "localtimed" ]) ];
-
-
options = {
-
services.localtimed = {
-
enable = mkOption {
-
type = types.bool;
-
default = false;
-
description = lib.mdDoc ''
-
Enable `localtimed`, 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.appConfig.localtimed = {
-
isAllowed = true;
-
isSystem = true;
-
};
-
-
# Install the polkit rules.
-
environment.systemPackages = [ pkgs.localtime ];
-
# Install the systemd unit.
-
systemd.packages = [ pkgs.localtime ];
-
-
systemd.services.localtime.wantedBy = [ "multi-user.target" ];
-
};
-
}
+66
nixos/modules/services/system/localtimed.nix
···
+
{ config, lib, pkgs, ... }:
+
+
with lib;
+
+
let
+
cfg = config.services.localtimed;
+
in {
+
imports = [ (lib.mkRenamedOptionModule [ "services" "localtime" ] [ "services" "localtimed" ]) ];
+
+
options = {
+
services.localtimed = {
+
enable = mkOption {
+
type = types.bool;
+
default = false;
+
description = lib.mdDoc ''
+
Enable `localtimed`, 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.appConfig.localtimed = {
+
isAllowed = true;
+
isSystem = true;
+
users = [ (toString config.ids.uids.localtimed) ];
+
};
+
+
# Install the polkit rules.
+
environment.systemPackages = [ pkgs.localtime ];
+
+
systemd.services.localtimed = {
+
wantedBy = [ "multi-user.target" ];
+
partOf = [ "localtimed-geoclue-agent.service" ];
+
after = [ "localtimed-geoclue-agent.service" ];
+
serviceConfig = {
+
ExecStart = "${pkgs.localtime}/bin/localtimed";
+
Restart = "on-failure";
+
Type = "exec";
+
User = "localtimed";
+
};
+
};
+
+
systemd.services.localtimed-geoclue-agent = {
+
wantedBy = [ "multi-user.target" ];
+
partOf = [ "geoclue.service" ];
+
after = [ "geoclue.service" ];
+
serviceConfig = {
+
ExecStart = "${pkgs.geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/agent";
+
Restart = "on-failure";
+
Type = "exec";
+
User = "localtimed";
+
};
+
};
+
+
users = {
+
users.localtimed = {
+
uid = config.ids.uids.localtimed;
+
group = "localtimed";
+
};
+
groups.localtimed.gid = config.ids.gids.localtimed;
+
};
+
};
+
}