1{ stdenv, lib, buildPythonPackage, fetchFromGitHub, augeas, cffi }: 2buildPythonPackage rec { 3 pname = "augeas"; 4 version = "1.0.2"; 5 name = pname + "-" + version; 6 7 src = fetchFromGitHub { 8 owner = "hercules-team"; 9 repo = "python-augeas"; 10 rev = "v${version}"; 11 sha256 = "1xk51m58ym3qpf0z5y98kzxb5jw7s92rca0v1yflj422977najxh"; 12 }; 13 14 # TODO: not very nice! 15 postPatch = 16 let libname = if stdenv.isDarwin then "libaugeas.dylib" else "libaugeas.so"; 17 in 18 '' 19 substituteInPlace augeas/ffi.py \ 20 --replace 'ffi.dlopen("augeas")' \ 21 'ffi.dlopen("${lib.makeLibraryPath [augeas]}/${libname}")' 22 ''; 23 24 propagatedBuildInputs = [ cffi augeas ]; 25 26 doCheck = false; 27 28 meta = with lib; { 29 description = "Pure python bindings for augeas"; 30 homepage = https://github.com/hercules-team/python-augeas; 31 license = licenses.lgpl2Plus; 32 platforms = platforms.unix; 33 }; 34}