nixpkgs/pkgs/servers/ankisyncd/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

69 lines
1.7 KiB
Nix
Raw Normal View History

2020-03-09 21:08:44 +00:00
{ lib
, fetchFromGitHub
, python3
}:
python3.pkgs.buildPythonApplication rec {
pname = "ankisyncd";
version = "2.2.0";
2020-03-09 21:08:44 +00:00
src = fetchFromGitHub {
owner = "ankicommunity";
2020-03-09 21:08:44 +00:00
repo = "anki-sync-server";
rev = version;
hash = "sha256-RXrdJGJ+HMSpDGQBuVPPqsh3+uwAgE6f7ZJ0yFRMI8I=";
fetchSubmodules = true;
2020-03-09 21:08:44 +00:00
};
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}
2020-03-09 21:08:44 +00:00
mkdir $out/share
cp ankisyncctl.py $out/share/
runHook postInstall
'';
fixupPhase = ''
PYTHONPATH="$PYTHONPATH:$out/${python3.sitePackages}"
2020-03-09 21:08:44 +00:00
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"
'';
nativeCheckInputs = with python3.pkgs; [
2020-03-09 21:08:44 +00:00
pytest
webtest
];
buildInputs = [ ];
propagatedBuildInputs = with python3.pkgs; [
decorator
requests
];
2020-03-09 21:08:44 +00:00
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
2020-03-09 21:08:44 +00:00
pytest --ignore tests/test_web_media.py tests/
'';
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;
2020-03-09 21:08:44 +00:00
platforms = platforms.linux;
};
}