Files
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

83 lines
1.5 KiB
Nix

{
config,
lib,
pkgs,
...
}:
let
inherit (pkgs) htpdate;
cfg = config.services.htpdate;
in
{
###### interface
options = {
services.htpdate = {
enable = lib.mkOption {
type = lib.types.bool;
default = false;
description = ''
Enable htpdate daemon.
'';
};
extraOptions = lib.mkOption {
type = lib.types.str;
default = "";
description = ''
Additional command line arguments to pass to htpdate.
'';
};
servers = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ "www.google.com" ];
description = ''
HTTP servers to use for time synchronization.
'';
};
proxy = lib.mkOption {
type = lib.types.str;
default = "";
example = "127.0.0.1:8118";
description = ''
HTTP proxy used for requests.
'';
};
};
};
###### implementation
config = lib.mkIf cfg.enable {
systemd.services.htpdate = {
description = "htpdate daemon";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "forking";
PIDFile = "/run/htpdate.pid";
ExecStart = lib.concatStringsSep " " [
"${htpdate}/bin/htpdate"
"-D -u nobody"
"-a -s"
"-l"
"${lib.optionalString (cfg.proxy != "") "-P ${cfg.proxy}"}"
"${cfg.extraOptions}"
"${lib.concatStringsSep " " cfg.servers}"
];
};
};
};
}