Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

92 lines
2.1 KiB
Nix
Raw Normal View History

2024-05-20 03:38:49 -04:00
{
lib,
stdenv,
rustPlatform,
fetchFromGitHub,
ntpd-rs,
installShellFiles,
pandoc,
Security,
nixosTests,
testers,
2023-08-26 01:51:24 +02:00
}:
rustPlatform.buildRustPackage rec {
pname = "ntpd-rs";
version = "1.1.3";
2023-08-26 01:51:24 +02:00
src = fetchFromGitHub {
owner = "pendulum-project";
repo = "ntpd-rs";
rev = "v${version}";
hash = "sha256-7b0IZLTt9ROEhp9bOBOvNQmS+iuQjgSrdwL1Nxy46t4=";
2023-08-26 01:51:24 +02:00
};
cargoHash = "sha256-FgRVWo27gdIzUNNTqgu7oHwrKSaWDA+sgL8kGak0otA=";
2023-10-31 14:27:42 +00:00
2024-05-20 03:38:49 -04:00
buildInputs = lib.optionals stdenv.isDarwin [ Security ];
nativeBuildInputs = [
pandoc
installShellFiles
];
2023-10-31 14:27:42 +00:00
postPatch = ''
substituteInPlace utils/generate-man.sh \
2024-05-20 03:38:49 -04:00
--replace-fail 'utils/pandoc.sh' 'pandoc'
2023-10-31 14:27:42 +00:00
'';
postBuild = ''
source utils/generate-man.sh
'';
# tests don't compile for 1.1.3
# https://github.com/pendulum-project/ntpd-rs/actions/runs/9712796372/job/26808251482
doCheck = false;
2023-08-26 01:51:24 +02:00
checkFlags = [
# doesn't find the testca
"--skip=daemon::keyexchange::tests"
2023-10-31 14:27:42 +00:00
# seems flaky?
2023-08-26 01:51:24 +02:00
"--skip=algorithm::kalman::peer::tests::test_offset_steering_and_measurements"
# needs networking
"--skip=hwtimestamp::tests::get_hwtimestamp"
];
postInstall = ''
2023-10-31 14:27:42 +00:00
install -Dm444 -t $out/lib/systemd/system docs/examples/conf/{ntpd-rs,ntpd-rs-metrics}.service
installManPage docs/precompiled/man/{ntp.toml.5,ntp-ctl.8,ntp-daemon.8,ntp-metrics-exporter.8}
2023-08-26 01:51:24 +02:00
'';
2024-05-20 03:38:49 -04:00
outputs = [
"out"
"man"
];
2023-08-26 01:51:24 +02:00
2024-05-20 03:32:23 -04:00
passthru = {
tests = {
nixos = lib.optionalAttrs stdenv.isLinux nixosTests.ntpd-rs;
2024-05-20 03:34:36 -04:00
version = testers.testVersion {
package = ntpd-rs;
inherit version;
};
2024-05-20 03:32:23 -04:00
};
};
2023-08-26 01:51:24 +02:00
meta = with lib; {
description = "Full-featured implementation of the Network Time Protocol";
2023-08-26 01:51:24 +02:00
homepage = "https://tweedegolf.nl/en/pendulum";
changelog = "https://github.com/pendulum-project/ntpd-rs/blob/v${version}/CHANGELOG.md";
2024-05-20 03:34:22 -04:00
mainProgram = "ntp-ctl";
2024-05-20 03:38:49 -04:00
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;
2023-08-26 01:51:24 +02:00
};
}