diff --git a/pkgs/tools/networking/chrony/default.nix b/pkgs/tools/networking/chrony/default.nix index de710e6b3f1..2b1bee85bcf 100644 --- a/pkgs/tools/networking/chrony/default.nix +++ b/pkgs/tools/networking/chrony/default.nix @@ -1,5 +1,7 @@ -{ lib, stdenv, fetchurl, pkg-config, libcap, readline, texinfo, nss, nspr -, libseccomp, pps-tools, gnutls }: +{ lib, stdenv, fetchurl, pkg-config +, gnutls, libedit, nspr, nss, readline, texinfo +, libcap, libseccomp, pps-tools +}: stdenv.mkDerivation rec { pname = "chrony"; @@ -7,22 +9,33 @@ stdenv.mkDerivation rec { src = fetchurl { url = "https://download.tuxfamily.org/chrony/${pname}-${version}.tar.gz"; - sha256 = "sha256-nQ2oiahl8ImlohYQ/7ZxPjyUOM4wOmO0nC+26v9biAQ="; + hash = "sha256-nQ2oiahl8ImlohYQ/7ZxPjyUOM4wOmO0nC+26v9biAQ="; }; + outputs = [ "out" "man" ]; + + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ gnutls libedit nspr nss readline texinfo ] + ++ lib.optionals stdenv.isLinux [ libcap libseccomp pps-tools ]; + + configureFlags = [ + "--enable-ntp-signd" + "--sbindir=$(out)/bin" + "--chronyrundir=/run/chrony" + ] ++ lib.optional stdenv.isLinux "--enable-scfilter"; + + patches = [ + # Cleanup the installation script + ./makefile.patch + ]; + postPatch = '' patchShebangs test ''; - buildInputs = [ readline texinfo nss nspr gnutls ] - ++ lib.optionals stdenv.isLinux [ libcap libseccomp pps-tools ]; - nativeBuildInputs = [ pkg-config ]; - hardeningEnable = [ "pie" ]; - configureFlags = [ "--chronyvardir=$(out)/var/lib/chrony" "--enable-ntp-signd" ] - ++ lib.optional stdenv.isLinux "--enable-scfilter"; - meta = with lib; { description = "Sets your computer's clock from time servers on the Net"; homepage = "https://chrony.tuxfamily.org/"; diff --git a/pkgs/tools/networking/chrony/makefile.patch b/pkgs/tools/networking/chrony/makefile.patch new file mode 100644 index 00000000000..be15ccb5cb2 --- /dev/null +++ b/pkgs/tools/networking/chrony/makefile.patch @@ -0,0 +1,23 @@ +diff --git a/Makefile.in b/Makefile.in +index ef100a4..47f54f4 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -23,7 +23,7 @@ + + SYSCONFDIR = @SYSCONFDIR@ + BINDIR = @BINDIR@ +-SBINDIR = @SBINDIR@ ++SBINDIR = @BINDIR@ + LOCALSTATEDIR = @LOCALSTATEDIR@ + CHRONYVARDIR = @CHRONYVARDIR@ + DESTDIR = +@@ -86,9 +86,7 @@ getdate : + + install: chronyd chronyc + [ -d $(DESTDIR)$(SYSCONFDIR) ] || mkdir -p $(DESTDIR)$(SYSCONFDIR) +- [ -d $(DESTDIR)$(SBINDIR) ] || mkdir -p $(DESTDIR)$(SBINDIR) + [ -d $(DESTDIR)$(BINDIR) ] || mkdir -p $(DESTDIR)$(BINDIR) +- [ -d $(DESTDIR)$(CHRONYVARDIR) ] || mkdir -p $(DESTDIR)$(CHRONYVARDIR) + if [ -f $(DESTDIR)$(SBINDIR)/chronyd ]; then rm -f $(DESTDIR)$(SBINDIR)/chronyd ; fi + if [ -f $(DESTDIR)$(BINDIR)/chronyc ]; then rm -f $(DESTDIR)$(BINDIR)/chronyc ; fi + cp chronyd $(DESTDIR)$(SBINDIR)/chronyd