lol

nixos: add htpdate module

Jookia e23cc550 a83eadd8

+81
+1
nixos/modules/module-list.nix
··· 354 354 ./services/networking/haproxy.nix 355 355 ./services/networking/heyefi.nix 356 356 ./services/networking/hostapd.nix 357 + ./services/networking/htpdate.nix 357 358 ./services/networking/i2pd.nix 358 359 ./services/networking/i2p.nix 359 360 ./services/networking/iodine.nix
+80
nixos/modules/services/networking/htpdate.nix
··· 1 + { config, lib, pkgs, ... }: 2 + 3 + with lib; 4 + 5 + let 6 + inherit (pkgs) htpdate; 7 + 8 + cfg = config.services.htpdate; 9 + in 10 + 11 + { 12 + 13 + ###### interface 14 + 15 + options = { 16 + 17 + services.htpdate = { 18 + 19 + enable = mkOption { 20 + type = types.bool; 21 + default = false; 22 + description = '' 23 + Enable htpdate daemon. 24 + ''; 25 + }; 26 + 27 + extraOptions = mkOption { 28 + type = types.str; 29 + default = ""; 30 + description = '' 31 + Additional command line arguments to pass to htpdate. 32 + ''; 33 + }; 34 + 35 + servers = mkOption { 36 + type = types.listOf types.str; 37 + default = [ "www.google.com" ]; 38 + description = '' 39 + HTTP servers to use for time synchronization. 40 + ''; 41 + }; 42 + 43 + proxy = mkOption { 44 + type = types.str; 45 + default = ""; 46 + example = "127.0.0.1:8118"; 47 + description = '' 48 + HTTP proxy used for requests. 49 + ''; 50 + }; 51 + 52 + }; 53 + 54 + }; 55 + 56 + ###### implementation 57 + 58 + config = mkIf cfg.enable { 59 + 60 + systemd.services.htpdate = { 61 + description = "htpdate daemon"; 62 + wantedBy = [ "multi-user.target" ]; 63 + serviceConfig = { 64 + Type = "forking"; 65 + PIDFile = "/var/run/htpdate.pid"; 66 + ExecStart = concatStringsSep " " [ 67 + "${htpdate}/bin/htpdate" 68 + "-D -u nobody" 69 + "-a -s" 70 + "-l" 71 + "${optionalString (cfg.proxy != "") "-P ${cfg.proxy}"}" 72 + "${cfg.extraOptions}" 73 + "${concatStringsSep " " cfg.servers}" 74 + ]; 75 + }; 76 + }; 77 + 78 + }; 79 + 80 + }