2024-05-20 07:38:49 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
rustPlatform,
|
|
|
|
fetchFromGitHub,
|
|
|
|
ntpd-rs,
|
|
|
|
installShellFiles,
|
2024-07-15 17:47:55 +00:00
|
|
|
darwin,
|
2024-05-20 07:38:49 +00:00
|
|
|
pandoc,
|
|
|
|
nixosTests,
|
2024-07-15 17:51:16 +00:00
|
|
|
nix-update-script,
|
2024-05-20 07:38:49 +00:00
|
|
|
testers,
|
2023-08-25 23:51:24 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "ntpd-rs";
|
2024-07-22 10:18:58 +00:00
|
|
|
version = "1.2.3";
|
2023-08-25 23:51:24 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "pendulum-project";
|
|
|
|
repo = "ntpd-rs";
|
|
|
|
rev = "v${version}";
|
2024-07-22 10:18:58 +00:00
|
|
|
hash = "sha256-Yf1cPv4SpmbL3o9uf3fJ/n0/ZW0wdhW/bbe2hRxDdyY=";
|
2023-08-25 23:51:24 +00:00
|
|
|
};
|
|
|
|
|
2024-07-22 10:18:58 +00:00
|
|
|
cargoHash = "sha256-H3pK/MSv7/YDEtnW2mi2xt5x2t3ugCc4IN43wohM4Ig=";
|
2023-10-31 14:27:42 +00:00
|
|
|
|
2024-07-15 17:47:55 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ darwin.apple_sdk_11_0.frameworks.Security ];
|
2024-05-20 07:38:49 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
pandoc
|
|
|
|
installShellFiles
|
2024-05-20 07:24:52 +00:00
|
|
|
];
|
2023-10-31 14:27:42 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace utils/generate-man.sh \
|
2024-05-20 07:38:49 +00:00
|
|
|
--replace-fail 'utils/pandoc.sh' 'pandoc'
|
2023-10-31 14:27:42 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postBuild = ''
|
|
|
|
source utils/generate-man.sh
|
|
|
|
'';
|
|
|
|
|
2024-07-20 01:06:54 +00:00
|
|
|
# lots of flaky tests
|
|
|
|
doCheck = false;
|
|
|
|
|
2023-08-25 23:51:24 +00:00
|
|
|
checkFlags = [
|
|
|
|
# doesn't find the testca
|
2024-05-20 07:24:52 +00:00
|
|
|
"--skip=daemon::keyexchange::tests"
|
2023-08-25 23:51:24 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
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-25 23:51:24 +00:00
|
|
|
'';
|
|
|
|
|
2024-05-20 07:38:49 +00:00
|
|
|
outputs = [
|
|
|
|
"out"
|
|
|
|
"man"
|
|
|
|
];
|
2023-08-25 23:51:24 +00:00
|
|
|
|
2024-05-20 07:32:23 +00:00
|
|
|
passthru = {
|
|
|
|
tests = {
|
|
|
|
nixos = lib.optionalAttrs stdenv.isLinux nixosTests.ntpd-rs;
|
2024-05-20 07:34:36 +00:00
|
|
|
version = testers.testVersion {
|
|
|
|
package = ntpd-rs;
|
|
|
|
inherit version;
|
|
|
|
};
|
2024-05-20 07:32:23 +00:00
|
|
|
};
|
2024-07-15 17:51:16 +00:00
|
|
|
|
|
|
|
updateScript = nix-update-script { };
|
2024-05-20 07:32:23 +00:00
|
|
|
};
|
|
|
|
|
2024-07-13 11:34:53 +00:00
|
|
|
meta = {
|
2023-08-25 23:51:24 +00:00
|
|
|
description = "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";
|
2024-05-20 07:34:22 +00:00
|
|
|
mainProgram = "ntp-ctl";
|
2024-07-13 11:34:53 +00:00
|
|
|
license = with lib.licenses; [
|
2024-05-20 07:38:49 +00:00
|
|
|
mit # or
|
|
|
|
asl20
|
|
|
|
];
|
2024-07-13 11:34:53 +00:00
|
|
|
maintainers = with lib.maintainers; [
|
2024-05-20 07:38:49 +00:00
|
|
|
fpletz
|
|
|
|
getchoo
|
|
|
|
];
|
2024-05-19 08:43:33 +00:00
|
|
|
# note: Undefined symbols for architecture x86_64: "_ntp_adjtime"
|
|
|
|
broken = stdenv.isDarwin && stdenv.isx86_64;
|
2023-08-25 23:51:24 +00:00
|
|
|
};
|
|
|
|
}
|