summary refs log tree commit diff
path: root/pkgs/os-specific/linux/audit
diff options
context:
space:
mode:
authorroblabla <unfiltered@roblab.la>2021-05-17 11:46:16 +0200
committerroblabla <unfiltered@roblab.la>2022-02-03 21:01:57 +0100
commitf67b8ea731208e14953d068ed6f506f83a049e3a (patch)
tree02841f82c9eec5754693dc2a48f928df11ff42ab /pkgs/os-specific/linux/audit
parentb964d23a917d127e82781b17d70efbaf2ecb56ea (diff)
downloadnixpkgs-f67b8ea731208e14953d068ed6f506f83a049e3a.tar
nixpkgs-f67b8ea731208e14953d068ed6f506f83a049e3a.tar.gz
nixpkgs-f67b8ea731208e14953d068ed6f506f83a049e3a.tar.bz2
nixpkgs-f67b8ea731208e14953d068ed6f506f83a049e3a.tar.lz
nixpkgs-f67b8ea731208e14953d068ed6f506f83a049e3a.tar.xz
nixpkgs-f67b8ea731208e14953d068ed6f506f83a049e3a.tar.zst
nixpkgs-f67b8ea731208e14953d068ed6f506f83a049e3a.zip
audit: Fix python bindings
Diffstat (limited to 'pkgs/os-specific/linux/audit')
-rw-r--r--pkgs/os-specific/linux/audit/default.nix12
1 files changed, 7 insertions, 5 deletions
diff --git a/pkgs/os-specific/linux/audit/default.nix b/pkgs/os-specific/linux/audit/default.nix
index 9fd24eea6d9..b685de0d14d 100644
--- a/pkgs/os-specific/linux/audit/default.nix
+++ b/pkgs/os-specific/linux/audit/default.nix
@@ -3,11 +3,10 @@
   runCommand,
   autoreconfHook,
   autoconf, automake, libtool,
-  enablePython ? false, python ? null,
+  enablePython ? true, python, swig,
+  linuxHeaders ? stdenv.cc.libc.linuxHeaders
 }:
 
-assert enablePython -> python != null;
-
 stdenv.mkDerivation rec {
   pname = "audit";
   version = "2.8.5"; # at the next release, remove the patches below!
@@ -21,7 +20,7 @@ stdenv.mkDerivation rec {
 
   depsBuildBuild = [ buildPackages.stdenv.cc ];
   nativeBuildInputs = [ autoreconfHook ];
-  buildInputs = lib.optional enablePython python;
+  buildInputs = lib.optionals enablePython [ python swig ];
 
   configureFlags = [
     # z/OS plugin is not useful on Linux,
@@ -69,8 +68,11 @@ stdenv.mkDerivation rec {
     })
   ];
 
-  prePatch = ''
+  postPatch = ''
     sed -i 's,#include <sys/poll.h>,#include <poll.h>\n#include <limits.h>,' audisp/audispd.c
+    substituteInPlace bindings/swig/src/auditswig.i \
+      --replace "/usr/include/linux/audit.h" \
+                "${linuxHeaders}/include/linux/audit.h"
   ''
   # According to https://stackoverflow.com/questions/13089166
   # --whole-archive linker flag is required to be sure that linker