about summary refs log tree commit diff
path: root/nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix')
-rw-r--r--nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix40
1 files changed, 40 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix b/nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix
new file mode 100644
index 000000000000..e530850221c0
--- /dev/null
+++ b/nixpkgs/pkgs/os-specific/linux/libcap-ng/default.nix
@@ -0,0 +1,40 @@
+{ stdenv, fetchurl, swig ? null, python2 ? null, python3 ? null }:
+
+assert python2 != null || python3 != null -> swig != null;
+
+stdenv.mkDerivation rec {
+  name = "libcap-ng-${version}";
+  # When updating make sure to test that the version with
+  # all of the python bindings still works
+  version = "0.7.9";
+
+  src = fetchurl {
+    url = "${meta.homepage}/${name}.tar.gz";
+    sha256 = "0a0k484kwv0zilry2mbl9k56cnpdhsjxdxin17jas6kkyfy345aa";
+  };
+
+  nativeBuildInputs = [ swig ];
+  buildInputs = [ python2 python3 ];
+
+  postPatch = ''
+    function get_header() {
+      echo -e "#include <$1>" | gcc -M -xc - | tr ' ' '\n' | grep "$1" | head -n 1
+    }
+
+    # Fix some hardcoding of header paths
+    sed -i "s,/usr/include/linux/capability.h,$(get_header linux/capability.h),g" bindings/python{,3}/Makefile.in
+  '';
+
+  configureFlags = [
+    (if python2 != null then "--with-python" else "--without-python")
+    (if python3 != null then "--with-python3" else "--without-python3")
+  ];
+
+  meta = let inherit (stdenv.lib) platforms licenses maintainers; in {
+    description = "Library for working with POSIX capabilities";
+    homepage = https://people.redhat.com/sgrubb/libcap-ng/;
+    platforms = platforms.linux;
+    license = licenses.lgpl21;
+    maintainers = with maintainers; [ wkennington ];
+  };
+}