about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2023-06-04 06:59:55 +0900
committerDominique Martinet <asmadeus@codewreck.org>2023-07-04 18:14:18 +0900
commitfbe3e3b44e64f20236c568bd11c0e5c82f5c1792 (patch)
tree12e32904df0649a0c9d69d3c44b84fffe9a06e20 /pkgs
parent668f528b6ca75a0a80ab5bb137d85a4ba677c603 (diff)
replace ankisyncd with ankisyncd-rs
- remove old ankisyncd python package
- rename new rust package so it's a drop in replacement
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/servers/ankisyncd-rs/default.nix52
-rw-r--r--pkgs/servers/ankisyncd/Cargo.lock (renamed from pkgs/servers/ankisyncd-rs/Cargo.lock)0
-rw-r--r--pkgs/servers/ankisyncd/default.nix102
-rw-r--r--pkgs/top-level/all-packages.nix6
4 files changed, 44 insertions, 116 deletions
diff --git a/pkgs/servers/ankisyncd-rs/default.nix b/pkgs/servers/ankisyncd-rs/default.nix
deleted file mode 100644
index 3c6c9b3ec76fe..0000000000000
--- a/pkgs/servers/ankisyncd-rs/default.nix
+++ /dev/null
@@ -1,52 +0,0 @@
-{ lib, runCommand, fetchFromGitHub, rustPlatform, protobuf }:
-
-let
-  pname = "ankisyncd-rs";
-  version = "1.1.3";
-
-  # anki-sync-server-rs expects anki sources in the 'anki' folder
-  # of its own source tree, with a patch applied (mostly to make
-  # some modules public): prepare our own 'src' manually
-  src = runCommand "anki-sync-server-rs-src" {
-    src = fetchFromGitHub {
-      owner = "ankicommunity";
-      repo = "anki-sync-server-rs";
-      rev = version;
-      hash = "sha256-y7X4jsPBykdpWXXaybdy6+XL3F2wZ9c9NvFornCes3M=";
-    };
-  } ''
-    cp -r "$src/." "$out"
-    chmod +w "$out"
-    cp -r "${ankiSrc}" "$out/anki"
-    chmod -R +w "$out/anki"
-    patch -d "$out/anki" -Np1 < "$src/anki_patch/d9d36078f17a2b4b8b44fcb802eb274911ebabe7_anki_rslib.patch"
-  '';
-
-  # Note we do not use anki.src because the patch in ankisyncd's
-  # sources expect a fixed version, so we pin it here.
-  ankiSrc = fetchFromGitHub {
-    owner = "ankitects";
-    repo = "anki";
-    rev = "2.1.60";
-    hash = "sha256-hNrf6asxF7r7QK2XO150yiRjyHAYKN8OFCFYX0SAiwA=";
-    fetchSubmodules = true;
-  };
-in rustPlatform.buildRustPackage {
-  inherit pname version src;
-
-  cargoLock = {
-    lockFile = ./Cargo.lock;
-    outputHashes = {
-      "csv-1.1.6" = "sha256-w728ffOVkI+IfK6FbmkGhr0CjuyqgJnPB1kutMJIUYg=";
-    };
-  };
-
-  nativeBuildInputs = [ protobuf ];
-
-  meta = with lib; {
-    description = "Standalone unofficial anki sync server";
-    homepage = "https://github.com/ankicommunity/anki-sync-server-rs";
-    license = with licenses; [ agpl3Only ];
-    maintainers = with maintainers; [ martinetd ];
-  };
-}
diff --git a/pkgs/servers/ankisyncd-rs/Cargo.lock b/pkgs/servers/ankisyncd/Cargo.lock
index cfbe4bfcf5943..cfbe4bfcf5943 100644
--- a/pkgs/servers/ankisyncd-rs/Cargo.lock
+++ b/pkgs/servers/ankisyncd/Cargo.lock
diff --git a/pkgs/servers/ankisyncd/default.nix b/pkgs/servers/ankisyncd/default.nix
index b5e91bc1bb638..6e0f0ebd54183 100644
--- a/pkgs/servers/ankisyncd/default.nix
+++ b/pkgs/servers/ankisyncd/default.nix
@@ -1,68 +1,52 @@
-{ lib
-, fetchFromGitHub
-, python3
-}:
+{ lib, runCommand, fetchFromGitHub, rustPlatform, protobuf }:
 
-python3.pkgs.buildPythonApplication rec {
+let
   pname = "ankisyncd";
-  version = "2.2.0";
-  src = fetchFromGitHub {
-    owner = "ankicommunity";
-    repo = "anki-sync-server";
-    rev = version;
-    hash = "sha256-RXrdJGJ+HMSpDGQBuVPPqsh3+uwAgE6f7ZJ0yFRMI8I=";
-    fetchSubmodules = true;
-  };
-  format = "other";
-
-  installPhase = ''
-    runHook preInstall
-
-    mkdir -p $out/${python3.sitePackages}
-
-    cp -r ankisyncd utils ankisyncd.conf $out/${python3.sitePackages}
-    cp -r anki-bundled/anki $out/${python3.sitePackages}
-    mkdir $out/share
-    cp ankisyncctl.py $out/share/
-
-    runHook postInstall
-  '';
-
-  fixupPhase = ''
-    PYTHONPATH="$PYTHONPATH:$out/${python3.sitePackages}"
-
-    makeWrapper "${python3.interpreter}" "$out/bin/ankisyncd" \
-          --set PYTHONPATH $PYTHONPATH \
-          --add-flags "-m ankisyncd"
-
-    makeWrapper "${python3.interpreter}" "$out/bin/ankisyncctl" \
-          --set PYTHONPATH $PYTHONPATH \
-          --add-flags "$out/share/ankisyncctl.py"
+  version = "1.1.3";
+
+  # anki-sync-server-rs expects anki sources in the 'anki' folder
+  # of its own source tree, with a patch applied (mostly to make
+  # some modules public): prepare our own 'src' manually
+  src = runCommand "anki-sync-server-rs-src" {
+    src = fetchFromGitHub {
+      owner = "ankicommunity";
+      repo = "anki-sync-server-rs";
+      rev = version;
+      hash = "sha256-y7X4jsPBykdpWXXaybdy6+XL3F2wZ9c9NvFornCes3M=";
+    };
+  } ''
+    cp -r "$src/." "$out"
+    chmod +w "$out"
+    cp -r "${ankiSrc}" "$out/anki"
+    chmod -R +w "$out/anki"
+    patch -d "$out/anki" -Np1 < "$src/anki_patch/d9d36078f17a2b4b8b44fcb802eb274911ebabe7_anki_rslib.patch"
   '';
 
-  nativeCheckInputs = with python3.pkgs; [
-    pytest
-    webtest
-  ];
-
-  buildInputs = [ ];
-
-  propagatedBuildInputs = with python3.pkgs; [
-    decorator
-    requests
-  ];
+  # Note we do not use anki.src because the patch in ankisyncd's
+  # sources expect a fixed version, so we pin it here.
+  ankiSrc = fetchFromGitHub {
+    owner = "ankitects";
+    repo = "anki";
+    rev = "2.1.60";
+    hash = "sha256-hNrf6asxF7r7QK2XO150yiRjyHAYKN8OFCFYX0SAiwA=";
+    fetchSubmodules = true;
+  };
+in rustPlatform.buildRustPackage {
+  inherit pname version src;
+
+  cargoLock = {
+    lockFile = ./Cargo.lock;
+    outputHashes = {
+      "csv-1.1.6" = "sha256-w728ffOVkI+IfK6FbmkGhr0CjuyqgJnPB1kutMJIUYg=";
+    };
+  };
 
-  checkPhase = ''
-    # skip these tests, our files are too young:
-    # tests/test_web_media.py::SyncAppFunctionalMediaTest::test_sync_mediaChanges ValueError: ZIP does not support timestamps before 1980
-    pytest --ignore tests/test_web_media.py tests/
-  '';
+  nativeBuildInputs = [ protobuf ];
 
   meta = with lib; {
-    description = "Self-hosted Anki sync server";
-    maintainers = with maintainers; [ matt-snider ];
-    homepage = "https://github.com/ankicommunity/anki-sync-server";
-    license = licenses.agpl3Only;
-    platforms = platforms.linux;
+    description = "Standalone unofficial anki sync server";
+    homepage = "https://github.com/ankicommunity/anki-sync-server-rs";
+    license = with licenses; [ agpl3Only ];
+    maintainers = with maintainers; [ martinetd ];
   };
 }
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index f492937dc7547..27abce90be0e5 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -240,11 +240,7 @@ with pkgs;
 
   anders = callPackage ../applications/science/logic/anders { };
 
-  ankisyncd = callPackage ../servers/ankisyncd {
-    python3 = python39;
-  };
-
-  ankisyncd-rs = callPackage ../servers/ankisyncd-rs { };
+  ankisyncd = callPackage ../servers/ankisyncd { };
 
   ariang = callPackage ../servers/ariang { };