dragnpkgs/pkgs/crypto/cado-nfs/default.nix

90 lines
1.4 KiB
Nix
Raw Normal View History

2024-11-21 03:30:32 +00:00
{
fetchFromGitLab,
lib,
stdenv,
# library deps
ecm,
gmp,
hwloc,
python3,
sqlite,
# runtime deps
openssh,
rsync,
util-linux,
coreutils,
# build deps
cmake,
curl,
inetutils,
perl,
makeWrapper,
# options
useArch ? "znver4",
useTune ? "znver4",
}: stdenv.mkDerivation rec {
pname = "cado-nfs";
git-rev = "bb65fdf0aaee0cea5e2da368bb87651d35d02603";
version = builtins.substring 0 7 git-rev;
src = fetchFromGitLab {
domain = "gitlab.inria.fr";
owner = pname;
repo = pname;
rev = git-rev;
hash = "sha256-Ao8nX9rZ0ky7MK5qXGgMe4N160sPN/En6h/YdeI2/JU=";
};
patches = [
./0001-use-PATH-lookup-for-non-cado-programs.patch
];
buildInputs = [
gmp
ecm
python3
sqlite
hwloc
];
nativeBuildInputs = [
cmake
inetutils
curl
perl
makeWrapper
];
NIX_CFLAGS_COMPILE = "-Wno-stringop-overflow"
+ (lib.optionalString (useArch != null) " -march=${useArch}")
+ (lib.optionalString (useTune != null) " -mtune=${useTune}");
postPatch = ''
patchShebangs --build .
'';
postConfigure = ''
patchShebangs --build .
'';
cadoBinPath = lib.makeBinPath [
openssh
rsync
util-linux
coreutils
];
postInstall = ''
wrapProgram $out/bin/cado-nfs-client.py \
--prefix PATH : ${cadoBinPath}
wrapProgram $out/bin/cado-nfs.py \
--prefix PATH : ${cadoBinPath}
'';
}