1{ lib, stdenv, fetchurl, getopt, util-linuxMinimal, which, gperf, nix-update-script }:
2
3stdenv.mkDerivation rec {
4 pname = "libseccomp";
5 version = "2.5.4";
6
7 src = fetchurl {
8 url = "https://github.com/seccomp/libseccomp/releases/download/v${version}/libseccomp-${version}.tar.gz";
9 sha256 = "sha256-2CkCQAQFzwBoV07z3B/l9ZJiB1Q7oa5vjnoVdjUdy9s=";
10 };
11
12 outputs = [ "out" "lib" "dev" "man" "pythonsrc" ];
13
14 nativeBuildInputs = [ gperf ];
15 buildInputs = [ getopt ];
16
17 patchPhase = ''
18 patchShebangs .
19 '';
20
21 nativeCheckInputs = [ util-linuxMinimal which ];
22 doCheck = true;
23
24 # Hack to ensure that patchelf --shrink-rpath get rids of a $TMPDIR reference.
25 preFixup = "rm -rfv src";
26
27 # Copy the python module code into a tarball that we can export and use as the
28 # src input for buildPythonPackage calls
29 postInstall = ''
30 cp -R ./src/python/ tmp-pythonsrc/
31 tar -zcf $pythonsrc --mtime="@$SOURCE_DATE_EPOCH" --sort=name --transform s/tmp-pythonsrc/python-foundationdb/ ./tmp-pythonsrc/
32 '';
33
34 passthru = {
35 updateScript = nix-update-script { };
36 };
37
38 meta = with lib; {
39 description = "High level library for the Linux Kernel seccomp filter";
40 homepage = "https://github.com/seccomp/libseccomp";
41 license = licenses.lgpl21Only;
42 platforms = platforms.linux;
43 badPlatforms = [
44 "alpha-linux"
45 "loongarch64-linux"
46 "riscv32-linux"
47 "sparc-linux"
48 "sparc64-linux"
49 ];
50 maintainers = with maintainers; [ thoughtpolice ];
51 };
52}