summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2017-12-25 15:20:57 +0100
committerMatthieu Coudron <mattator@gmail.com>2018-04-23 17:19:26 +0900
commit49f55fa3375910259a7d9ba813121c3ca4096506 (patch)
tree1fe856645a9e98e9700eff9505848b17581337ef
parentf396f0937e69f843187e5c899e8e6a21123ec2ec (diff)
downloadnixlib-49f55fa3375910259a7d9ba813121c3ca4096506.tar
nixlib-49f55fa3375910259a7d9ba813121c3ca4096506.tar.gz
nixlib-49f55fa3375910259a7d9ba813121c3ca4096506.tar.bz2
nixlib-49f55fa3375910259a7d9ba813121c3ca4096506.tar.lz
nixlib-49f55fa3375910259a7d9ba813121c3ca4096506.tar.xz
nixlib-49f55fa3375910259a7d9ba813121c3ca4096506.tar.zst
nixlib-49f55fa3375910259a7d9ba813121c3ca4096506.zip
vdirsyncer: 0.16.4 -> 0.17.0a2
-rw-r--r--pkgs/tools/misc/vdirsyncer/default.nix51
1 files changed, 41 insertions, 10 deletions
diff --git a/pkgs/tools/misc/vdirsyncer/default.nix b/pkgs/tools/misc/vdirsyncer/default.nix
index 9d1e4096776a..9e9ded5c3a76 100644
--- a/pkgs/tools/misc/vdirsyncer/default.nix
+++ b/pkgs/tools/misc/vdirsyncer/default.nix
@@ -1,18 +1,30 @@
-{ stdenv, fetchurl, python3Packages, glibcLocales }:
+{ stdenv, python3Packages, glibcLocales, rustPlatform }:
 
 # Packaging documentation at:
 # https://github.com/untitaker/vdirsyncer/blob/master/docs/packaging.rst
 let
   pythonPackages = python3Packages;
-in
-pythonPackages.buildPythonApplication rec {
-  version = "0.16.4";
-  name = "vdirsyncer-${version}";
-
-  src = fetchurl {
-    url = "mirror://pypi/v/vdirsyncer/${name}.tar.gz";
-    sha256 = "03wva48bgv1ad3df6plc9b8xxh6k8bcaxrhlzwh81c9mzn5bspzv";
+  version = "0.17.0a2";
+  pname = "vdirsyncer";
+  name = pname + "-" + version;
+  src = pythonPackages.fetchPypi {
+    inherit pname version;
+    sha256 = "0y464rsx5la6bp94z2g0nnkbl4nwfya08abynvifw4c84vs1gr4q";
   };
+  native = rustPlatform.buildRustPackage {
+    name = name + "-native";
+    inherit src;
+    sourceRoot = name + "/rust";
+    cargoSha256 = "1cr7xs11gbsc3x5slga9qahchwc22qq49amf28g4jgs9lzf57qis";
+    postInstall = ''
+      mkdir $out/include $out/lib
+      cp $out/bin/libvdirsyncer_rustext* $out/lib
+      rm -r $out/bin
+      cp target/vdirsyncer_rustext.h $out/include
+    '';
+  };
+in pythonPackages.buildPythonApplication rec {
+  inherit version pname src;
 
   propagatedBuildInputs = with pythonPackages; [
     click click-log click-threading
@@ -20,14 +32,33 @@ pythonPackages.buildPythonApplication rec {
     requests
     requests_oauthlib # required for google oauth sync
     atomicwrites
+    milksnake
   ];
 
-  buildInputs = with pythonPackages; [hypothesis pytest pytest-localserver pytest-subtesthack setuptools_scm ] ++ [ glibcLocales ];
+  buildInputs = with pythonPackages; [ setuptools_scm ];
+
+  checkInputs = with pythonPackages; [ hypothesis pytest pytest-localserver pytest-subtesthack ] ++ [ glibcLocales ];
+
+  postPatch = ''
+    sed -i "/cargo build/d" Makefile
+  '';
+
+  preBuild = ''
+    mkdir -p rust/target/release
+    ln -s ${native}/lib/libvdirsyncer_rustext* rust/target/release/
+    ln -s ${native}/include/vdirsyncer_rustext.h rust/target/
+  '';
 
   LC_ALL = "en_US.utf8";
 
+  preCheck = ''
+    ln -sf ../dist/tmpbuild/vdirsyncer/vdirsyncer/_native__lib.so vdirsyncer
+  '';
+
   checkPhase = ''
+    runHook preCheck
     make DETERMINISTIC_TESTS=true test
+    runHook postCheck
   '';
 
   meta = with stdenv.lib; {