Unverified Commit 7189f1c8 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #313068 from getchoo/pkgs/ntpd-rs/1.1.2

ntpd-rs: 1.1.0 -> 1.1.2; passthru tests; adopt
parents 671eb6be 243d4e27
Loading
Loading
Loading
Loading
+44 −21
Original line number Diff line number Diff line
{ lib
, stdenv
, rustPlatform
, fetchFromGitHub
, installShellFiles
, pandoc
, Security
{
  lib,
  stdenv,
  rustPlatform,
  fetchFromGitHub,
  ntpd-rs,
  installShellFiles,
  pandoc,
  Security,
  nixosTests,
  testers,
}:

rustPlatform.buildRustPackage rec {
  pname = "ntpd-rs";
  version = "1.1.0";
  version = "1.1.2";

  src = fetchFromGitHub {
    owner = "pendulum-project";
    repo = "ntpd-rs";
    rev = "v${version}";
    hash = "sha256-IoTuI0M+stZNUVpaVsf7JR7uHcamSSVDMJxJ+7n5ayA=";
    hash = "sha256-0ykJruuyD1Z/QcmrogodNlMZp05ocXIo3wdygB/AnT0=";
  };

  cargoHash = "sha256-iZuDNFy8c2UZUh3J11lEtfHlDFN+qPl4iZg+ps7AenE=";
  cargoHash = "sha256-Badq3GYr7BoF8VNGGtKTT4/ksuds1zBcSxx5O3vLbzg=";

  buildInputs = lib.optionals stdenv.isDarwin ([
    Security
  ]);
  nativeBuildInputs = [ pandoc installShellFiles ];
  buildInputs = lib.optionals stdenv.isDarwin [ Security ];
  nativeBuildInputs = [
    pandoc
    installShellFiles
  ];

  postPatch = ''
    substituteInPlace utils/generate-man.sh \
      --replace 'utils/pandoc.sh' 'pandoc'
      --replace-fail 'utils/pandoc.sh' 'pandoc'
  '';

  postBuild = ''
    source utils/generate-man.sh
  '';

  doCheck = true;

  checkFlags = [
    # doesn't find the testca
    "--skip=keyexchange::tests::key_exchange_roundtrip"
    "--skip=daemon::keyexchange::tests"
    # seems flaky?
    "--skip=algorithm::kalman::peer::tests::test_offset_steering_and_measurements"
    # needs networking
@@ -50,14 +53,34 @@ rustPlatform.buildRustPackage rec {
    installManPage docs/precompiled/man/{ntp.toml.5,ntp-ctl.8,ntp-daemon.8,ntp-metrics-exporter.8}
  '';

  outputs = [ "out" "man" ];
  outputs = [
    "out"
    "man"
  ];

  passthru = {
    tests = {
      nixos = lib.optionalAttrs stdenv.isLinux nixosTests.ntpd-rs;
      version = testers.testVersion {
        package = ntpd-rs;
        inherit version;
      };
    };
  };

  meta = with lib; {
    description = "A full-featured implementation of the Network Time Protocol";
    homepage = "https://tweedegolf.nl/en/pendulum";
    changelog = "https://github.com/pendulum-project/ntpd-rs/blob/v${version}/CHANGELOG.md";
    license = with licenses; [ mit /* or */ asl20 ];
    maintainers = with maintainers; [ fpletz ];
    mainProgram = "ntp-ctl";
    license = with licenses; [
      mit # or
      asl20
    ];
    maintainers = with maintainers; [
      fpletz
      getchoo
    ];
    # note: Undefined symbols for architecture x86_64: "_ntp_adjtime"
    broken = stdenv.isDarwin && stdenv.isx86_64;
  };