git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #18818 from Jookia/RFC_htpdate

Rfc htpdate

commit7529fd3bff8e3aee5fbdc293922379de81c2cb85 authorJoachim F <joachifm@users.noreply.github.com> dateFri 23 Sep 2016, 15:19 (10 years ago) parent24135d6e23cc55
4 files changed+107
nixos/modules/module-list.nix+1 nixos/modules/services/networking/htpdate.nix+80 pkgs/tools/networking/htpdate/default.nix+24 pkgs/top-level/all-packages.nix+2
nixos/modules/module-list.nix+1
@@ -354,6 +354,7 @@
354354 ./services/networking/haproxy.nix
355355 ./services/networking/heyefi.nix
356356 ./services/networking/hostapd.nix
357+ ./services/networking/htpdate.nix
357358 ./services/networking/i2pd.nix
358359 ./services/networking/i2p.nix
359360 ./services/networking/iodine.nix
nixos/modules/services/networking/htpdate.nixnew file+80
@@ -0,0 +1,80 @@
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+}
pkgs/tools/networking/htpdate/default.nixnew file+24
@@ -0,0 +1,24 @@
1+{ stdenv, fetchurl, coreutils, binutils }:
2+
3+stdenv.mkDerivation rec {
4+ version = "1.1.3";
5+ name = "htpdate-${version}";
6+
7+ src = fetchurl {
8+ url = "http://twekkel.home.xs4all.nl/htp/htpdate-${version}.tar.gz";
9+ sha256 = "0hfg4qrsmpqw03m9qwf3zgi4brbf65w6wd3w30nkamc7x8b4vn5i";
10+ };
11+
12+ installFlags = [
13+ "INSTALL=${coreutils}/bin/install"
14+ "STRIP=${binutils}/bin/strip"
15+ "prefix=$(out)"
16+ ];
17+
18+ meta = {
19+ description = "Utility to fetch time and set the system clock over HTTP";
20+ homepage = http://www.vervest.org/htp/;
21+ platforms = stdenv.lib.platforms.linux;
22+ license = stdenv.lib.licenses.gpl2Plus;
23+ };
24+}
pkgs/top-level/all-packages.nix+2
@@ -2066,6 +2066,8 @@ in
20662066
20672067 hping = callPackage ../tools/networking/hping { };
20682068
2069+ htpdate = callPackage ../tools/networking/htpdate { };
2070+
20692071 http-prompt = callPackage ../tools/networking/http-prompt { };
20702072
20712073 httpie = callPackage ../tools/networking/httpie { };