From c4f7b48d2c55b11ff042dd7dfb0a5bbfc240d27c Mon Sep 17 00:00:00 2001 From: Johan Herland Date: Wed, 18 Jun 2025 10:08:36 +0000 Subject: [PATCH] pdqsort: init at unstable-2021-03-14 Co-authored-by: Alexander Bantyev Co-authored-by: kirillrdy --- pkgs/by-name/pd/pdqsort/package.nix | 49 +++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 pkgs/by-name/pd/pdqsort/package.nix diff --git a/pkgs/by-name/pd/pdqsort/package.nix b/pkgs/by-name/pd/pdqsort/package.nix new file mode 100644 index 000000000000..edb7c7a429d2 --- /dev/null +++ b/pkgs/by-name/pd/pdqsort/package.nix @@ -0,0 +1,49 @@ +{ + lib, + stdenvNoCC, + stdenv, # for tests + fetchFromGitHub, +}: + +stdenvNoCC.mkDerivation (finalAttrs: { + pname = "pdqsort"; + version = "0-unstable-2021-03-14"; + + src = fetchFromGitHub { + owner = "orlp"; + repo = "pdqsort"; + rev = "b1ef26a55cdb60d236a5cb199c4234c704f46726"; + hash = "sha256-xn3Jjn/jxJBckpg1Tx3HHVAWYPVTFMiDFiYgB2WX7Sc="; + }; + + installPhase = '' + runHook preInstall + + mkdir -p $out/include + cp -r *.h $out/include/ + + runHook postInstall + ''; + + # The benchmark takes too long to run as a regular checkPhase here. + passthru.tests.bench = stdenv.mkDerivation { + pname = "pdqsort-bench"; + + inherit (finalAttrs) version src; + + doCheck = true; + checkPhase = '' + c++ bench/bench.cpp -o bench/bench + ./bench/bench > $out + ''; + + meta.platforms = lib.platforms.x86_64; + }; + + meta = { + description = "Novel sorting algorithm that combines the fast average case of randomized quicksort with the fast worst case of heapsort"; + homepage = "https://github.com/orlp/pdqsort"; + license = lib.licenses.zlib; + maintainers = with lib.maintainers; [ jherland ]; + }; +})