6afb255d97
these changes were generated with nixq 0.0.2, by running nixq ">> lib.mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> mdDoc[remove] Argument[keep]" --batchmode nixos/**.nix nixq ">> Inherit >> mdDoc[remove]" --batchmode nixos/**.nix two mentions of the mdDoc function remain in nixos/, both of which are inside of comments. Since lib.mdDoc is already defined as just id, this commit is a no-op as far as Nix (and the built manual) is concerned.
80 lines
1.5 KiB
Nix
80 lines
1.5 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
inherit (pkgs) htpdate;
|
|
|
|
cfg = config.services.htpdate;
|
|
in
|
|
|
|
{
|
|
|
|
###### interface
|
|
|
|
options = {
|
|
|
|
services.htpdate = {
|
|
|
|
enable = mkOption {
|
|
type = types.bool;
|
|
default = false;
|
|
description = ''
|
|
Enable htpdate daemon.
|
|
'';
|
|
};
|
|
|
|
extraOptions = mkOption {
|
|
type = types.str;
|
|
default = "";
|
|
description = ''
|
|
Additional command line arguments to pass to htpdate.
|
|
'';
|
|
};
|
|
|
|
servers = mkOption {
|
|
type = types.listOf types.str;
|
|
default = [ "www.google.com" ];
|
|
description = ''
|
|
HTTP servers to use for time synchronization.
|
|
'';
|
|
};
|
|
|
|
proxy = mkOption {
|
|
type = types.str;
|
|
default = "";
|
|
example = "127.0.0.1:8118";
|
|
description = ''
|
|
HTTP proxy used for requests.
|
|
'';
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
###### implementation
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
systemd.services.htpdate = {
|
|
description = "htpdate daemon";
|
|
wantedBy = [ "multi-user.target" ];
|
|
serviceConfig = {
|
|
Type = "forking";
|
|
PIDFile = "/run/htpdate.pid";
|
|
ExecStart = concatStringsSep " " [
|
|
"${htpdate}/bin/htpdate"
|
|
"-D -u nobody"
|
|
"-a -s"
|
|
"-l"
|
|
"${optionalString (cfg.proxy != "") "-P ${cfg.proxy}"}"
|
|
"${cfg.extraOptions}"
|
|
"${concatStringsSep " " cfg.servers}"
|
|
];
|
|
};
|
|
};
|
|
|
|
};
|
|
|
|
}
|