Files

79 lines
1.8 KiB
Nix

{
lib,
stdenv,
fetchurl,
getopt,
util-linuxMinimal,
which,
gperf,
nix-update-script,
python3Packages,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "libseccomp";
version = "2.6.1";
src = fetchurl {
url = "https://github.com/seccomp/libseccomp/releases/download/v${finalAttrs.version}/libseccomp-${finalAttrs.version}.tar.gz";
hash = "sha256-UB9mxmciXVN5G5fh18+Fq3ZMKX0EiB9g849FHEsO4b4=";
};
outputs = [
"out"
"lib"
"dev"
"man"
"pythonsrc"
];
nativeBuildInputs = [ gperf ];
buildInputs = [ getopt ];
postPatch = ''
patchShebangs .
'';
nativeCheckInputs = [
util-linuxMinimal
which
];
doCheck = !(stdenv.targetPlatform.useLLVM or false);
# Hack to ensure that patchelf --shrink-rpath get rids of a $TMPDIR reference.
preFixup = "rm -rfv src";
# Copy the python module code into a tarball that we can export and use as the
# src input for buildPythonPackage calls
postInstall = ''
cp -R ./src/python/ tmp-pythonsrc/
tar -zcf $pythonsrc --mtime="@$SOURCE_DATE_EPOCH" --sort=name --transform s/tmp-pythonsrc/python-foundationdb/ ./tmp-pythonsrc/
'';
passthru = {
updateScript = nix-update-script { };
tests = {
inherit (python3Packages) seccomp;
};
};
meta = {
description = "High level library for the Linux Kernel seccomp filter";
mainProgram = "scmp_sys_resolver";
homepage = "https://github.com/seccomp/libseccomp";
license = lib.licenses.lgpl21Only;
platforms = lib.platforms.linux;
badPlatforms = [
"alpha-linux"
"m68k-linux"
"microblaze-linux"
"microblazeel-linux"
"riscv32-linux"
"sparc-linux"
"sparc64-linux"
];
maintainers = with lib.maintainers; [ thoughtpolice ];
identifiers.cpeParts = lib.meta.cpeFullVersionWithVendor "libseccomp_project" finalAttrs.version;
};
})