about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/adblock/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/adblock/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/adblock/default.nix36
1 files changed, 14 insertions, 22 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/adblock/default.nix b/nixpkgs/pkgs/development/python-modules/adblock/default.nix
index de6d72a61ecf..8fc697828f0a 100644
--- a/nixpkgs/pkgs/development/python-modules/adblock/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/adblock/default.nix
@@ -1,10 +1,9 @@
 { stdenv
 , lib
-, rustPlatform
 , fetchFromGitHub
-, pipInstallHook
+, buildPythonPackage
+, rustPlatform
 , pythonImportsCheckHook
-, maturin
 , pkg-config
 , openssl
 , publicsuffix-list
@@ -13,7 +12,7 @@
 , Security
 }:
 
-rustPlatform.buildRustPackage rec {
+buildPythonPackage rec {
   pname = "adblock";
   version = "0.4.0";
   disabled = isPy27;
@@ -25,39 +24,32 @@ rustPlatform.buildRustPackage rec {
     rev = version;
     sha256 = "10d6ks2fyzbizq3kb69q478idj0h86k6ygjb6wl3zq3mf65ma4zg";
   };
-  format = "pyproject";
 
-  cargoSha256 = "0di05j942rrm2crpdpp9czhh65fmidyrvdp2n3pipgnagy7nchc0";
+  cargoDeps = rustPlatform.fetchCargoTarball {
+    inherit src;
+    name = "${pname}-${version}";
+    hash = "sha256-gEFmj3/KvhvvsOK2nX2L1RUD4Wfp3nYzEzVnQZIsIDY=";
+  };
 
-  nativeBuildInputs = [ pipInstallHook maturin pkg-config pythonImportsCheckHook ];
+  format = "pyproject";
+
+  nativeBuildInputs = [ pkg-config pythonImportsCheckHook ]
+    ++ (with rustPlatform; [ cargoSetupHook maturinBuildHook ]);
 
   buildInputs = [ openssl ]
     ++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ];
 
   PSL_PATH = "${publicsuffix-list}/share/publicsuffix/public_suffix_list.dat";
 
-  buildPhase = ''
-    runHook preBuild
-    maturin build --release --manylinux off --strip
-    runHook postBuild
-  '';
-
   # There are no rust tests
   doCheck = false;
-  pythonImportsCheck = [ "adblock" ];
 
-  installPhase = ''
-    runHook preInstall
-    install -Dm644 -t dist target/wheels/*.whl
-    pipInstallPhase
-    runHook postInstall
-  '';
+  pythonImportsCheck = [ "adblock" ];
 
-  passthru.meta = with lib; {
+  meta = with lib; {
     description = "Python wrapper for Brave's adblocking library, which is written in Rust";
     homepage = "https://github.com/ArniDagur/python-adblock/";
     maintainers = with maintainers; [ petabyteboy ];
     license = with licenses; [ asl20 mit ];
-    platforms = with platforms; [ all ];
   };
 }