Merge pull request #195135 from maxbrunet/feat/automatic-timezoned/init

Changed files
+142
maintainers
nixos
doc
manual
from_md
release-notes
release-notes
modules
pkgs
tools
system
automatic-timezoned
top-level
+9
maintainers/maintainer-list.nix
···
fingerprint = "1DE4 424D BF77 1192 5DC4 CF5E 9AED 8814 81D8 444E";
}];
};
+
maxbrunet = {
+
email = "max@brnt.mx";
+
github = "maxbrunet";
+
githubId = 32458727;
+
name = "Maxime Brunet";
+
keys = [{
+
fingerprint = "E9A2 EE26 EAC6 B3ED 6C10 61F3 4379 62FF 87EC FE2B";
+
}];
+
};
maxdamantus = {
email = "maxdamantus@gmail.com";
github = "Maxdamantus";
+8
nixos/doc/manual/from_md/release-notes/rl-2211.section.xml
···
</listitem>
<listitem>
<para>
+
<link xlink:href="https://github.com/maxbrunet/automatic-timezoned">automatic-timezoned</link>.
+
a Linux daemon to automatically update the system timezone
+
based on location. Available as
+
<link linkend="opt-services.automatic-timezoned.enable">services.automatic-timezoned</link>.
+
</para>
+
</listitem>
+
<listitem>
+
<para>
[xray] (https://github.com/XTLS/Xray-core), a fully compatible
v2ray-core replacement. Features XTLS, which when enabled on
server and client, brings UDP FullCone NAT to proxy setups.
+2
nixos/doc/manual/release-notes/rl-2211.section.md
···
- [appvm](https://github.com/jollheef/appvm), Nix based app VMs. Available as [virtualisation.appvm](options.html#opt-virtualisation.appvm.enable).
+
- [automatic-timezoned](https://github.com/maxbrunet/automatic-timezoned). a Linux daemon to automatically update the system timezone based on location. Available as [services.automatic-timezoned](#opt-services.automatic-timezoned.enable).
+
- [xray] (https://github.com/XTLS/Xray-core), a fully compatible v2ray-core replacement. Features XTLS, which when enabled on server and client, brings UDP FullCone NAT to proxy setups. Available as [services.xray](options.html#opt-services.xray.enable).
- [syncstorage-rs](https://github.com/mozilla-services/syncstorage-rs), a self-hostable sync server for Firefox. Available as [services.firefox-syncserver](options.html#opt-services.firefox-syncserver.enable).
+2
nixos/modules/misc/ids.nix
···
pipewire = 323;
rstudio-server = 324;
localtimed = 325;
+
automatic-timezoned = 326;
# When adding a uid, make sure it doesn't match an existing gid. And don't use uids above 399!
···
pipewire = 323;
rstudio-server = 324;
localtimed = 325;
+
automatic-timezoned = 326;
# When adding a gid, make sure it doesn't match an existing
# uid. Users and groups with the same name should have equal
+1
nixos/modules/module-list.nix
···
./services/security/vault.nix
./services/security/vaultwarden/default.nix
./services/security/yubikey-agent.nix
+
./services/system/automatic-timezoned.nix
./services/system/cachix-agent/default.nix
./services/system/cachix-watch-store.nix
./services/system/cloud-init.nix
+92
nixos/modules/services/system/automatic-timezoned.nix
···
+
{ config, lib, pkgs, ... }:
+
+
with lib;
+
+
let
+
cfg = config.services.automatic-timezoned;
+
in
+
{
+
options = {
+
services.automatic-timezoned = {
+
enable = mkOption {
+
type = types.bool;
+
default = false;
+
description = mdDoc ''
+
Enable `automatic-timezoned`, 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.
+
'';
+
};
+
package = mkOption {
+
type = types.package;
+
default = pkgs.automatic-timezoned;
+
defaultText = literalExpression "pkgs.automatic-timezoned";
+
description = mdDoc ''
+
Which `automatic-timezoned` package to use.
+
'';
+
};
+
};
+
};
+
+
config = mkIf cfg.enable {
+
security.polkit.extraConfig = ''
+
polkit.addRule(function(action, subject) {
+
if (action.id == "org.freedesktop.timedate1.set-timezone"
+
&& subject.user == "automatic-timezoned") {
+
return polkit.Result.YES;
+
}
+
});
+
'';
+
+
services.geoclue2 = {
+
enable = true;
+
appConfig.automatic-timezoned = {
+
isAllowed = true;
+
isSystem = true;
+
users = [ (toString config.ids.uids.automatic-timezoned) ];
+
};
+
};
+
+
systemd.services = {
+
+
automatic-timezoned = {
+
description = "Automatically update system timezone based on location";
+
requires = [ "automatic-timezoned-geoclue-agent.service" ];
+
after = [ "automatic-timezoned-geoclue-agent.service" ];
+
serviceConfig = {
+
Type = "exec";
+
User = "automatic-timezoned";
+
ExecStart = "${cfg.package}/bin/automatic-timezoned --zoneinfo-path=${pkgs.tzdata}/share/zoneinfo/zone1970.tab";
+
};
+
wantedBy = [ "default.target" ];
+
};
+
+
automatic-timezoned-geoclue-agent = {
+
description = "Geoclue agent for automatic-timezoned";
+
requires = [ "geoclue.service" ];
+
after = [ "geoclue.service" ];
+
serviceConfig = {
+
Type = "exec";
+
User = "automatic-timezoned";
+
ExecStart = "${pkgs.geoclue2-with-demo-agent}/libexec/geoclue-2.0/demos/agent";
+
Restart = "on-failure";
+
PrivateTmp = true;
+
};
+
wantedBy = [ "default.target" ];
+
};
+
+
};
+
+
users = {
+
users.automatic-timezoned = {
+
description = "automatic-timezoned";
+
uid = config.ids.uids.automatic-timezoned;
+
group = "automatic-timezoned";
+
};
+
groups.automatic-timezoned = {
+
gid = config.ids.gids.automatic-timezoned;
+
};
+
};
+
};
+
}
+26
pkgs/tools/system/automatic-timezoned/default.nix
···
+
{ lib
+
, fetchFromGitHub
+
, rustPlatform
+
}:
+
+
rustPlatform.buildRustPackage rec {
+
pname = "automatic-timezoned";
+
version = "1.0.41";
+
+
src = fetchFromGitHub {
+
owner = "maxbrunet";
+
repo = pname;
+
rev = "v${version}";
+
sha256 = "sha256-KT1mVP2pMn6M8BPBdBgK94iLuAuoUwGo24L5IT5fVAQ=";
+
};
+
+
cargoSha256 = "sha256-hfhSbpNVJm6OE/wL3aPNRV+kJGIZnpoTh8e/trRG21c=";
+
+
meta = with lib; {
+
description = "Automatically update system timezone based on location";
+
homepage = "https://github.com/maxbrunet/automatic-timezoned";
+
license = licenses.gpl3;
+
maintainers = with maintainers; [ maxbrunet ];
+
platforms = platforms.linux;
+
};
+
}
+2
pkgs/top-level/all-packages.nix
···
inherit (darwin.apple_sdk.frameworks) Security SystemConfiguration;
};
+
automatic-timezoned = callPackage ../tools/system/automatic-timezoned { };
+
cve = with python3Packages; toPythonApplication cvelib;
fiche = callPackage ../servers/fiche { };