Skip to content

Commit

Permalink
Add Libervia-backend (#325)
Browse files Browse the repository at this point in the history
* doubleratchet: init at 1.0.4

* urwid-satext: init at 0.8.0-unstable-2024-04-08

* helium: init at 5.0.2

* libxeddsa: init at 2.0.0

* xeddsa: init at 1.0.3

* x3dh: init at 1.0.4

* wokkel: init at 18.0.0

* sat-tmp: init at 0.8.0

* omemo: init at 1.0.4

* oldmemo: init at 1.0.4

* twomemo: init at 1.0.4

* libervia-media: init at 0.8.0-unstable-2024-05-30

* libervia-templates: init at 0.8.0-unstable-2024-06-06

* libervia-backend: init at 0.8.0-unstable-2024-07-14

* projects/Libervia: Add module, test, examples

* projects/Libervia/test: Sleep abit after issuing workspace switch

Had it happen that switch wasn't fully processed yet when terminal was attempted to be spawned.

* libervia-backend: Adjust to upstream Nixpkgs bumps

* projects/Libervia/test: Adjust to upstream Nixpkgs bumps

* doubleratchet: 1.0.4 -> 1.1.0

* urwid-satext: Fix version

Typo'd year, commit is from 2023

* helium: 5.0.2 -> 5.1.0

* xeddsa: 1.0.3 -> 1.1.0

* x3dh: 1.0.4 -> 1.1.0

* omemo: 1.0.4 -> 1.2.0

* oldmemo: 1.0.4 -> 1.1.0

* twomemo: 1.0.4 -> 1.1.0

* libervia-media: 0.8.0-unstable-2024-05-30 -> 0.8.0-unstable-2024-10-26

This resolves the licensing issues.

* libervia-templates: 0.8.0-unstable-2024-06-06 -> 0.8.0-unstable-2024-10-26

* libervia-backend: 0.8.0-unstable-2024-07-14 -> 0.8.0-unstable-2024-10-26

* libervia-backend: Get rid of libervia-media switch

It's not a licensing problem anymore to include it.

* helium: Disable tests on unsupported platforms

Fails in selenium code about unsupported system & architecture combination on aarch64-linux.

* projects/Libervia/test: Fix on aarch64-linux

Failed to OCR for the fresh terminal contents, employ "sleep, increase size, then check" strategy.
  • Loading branch information
OPNA2608 authored Nov 10, 2024
1 parent 596d38d commit df8607b
Show file tree
Hide file tree
Showing 20 changed files with 3,735 additions and 0 deletions.
39 changes: 39 additions & 0 deletions pkgs/by-name/doubleratchet/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
python3Packages,
lib,
fetchFromGitHub,
}:
python3Packages.buildPythonPackage rec {
pname = "doubleratchet";
version = "1.1.0";
pyproject = true;

src = fetchFromGitHub {
owner = "Syndace";
repo = "python-doubleratchet";
rev = "refs/tags/v${version}";
hash = "sha256-yoph3u7LjGjSPi1hFlXzWmSNkCXvY/ocTt2MKa+F1fs=";
};

strictDeps = true;

nativeBuildInputs = with python3Packages; [setuptools];

propagatedBuildInputs = with python3Packages; [
cryptography
pydantic
typing-extensions
];

pythonImportsCheck = [
"doubleratchet"
];

meta = {
description = "Python implementation of the Double Ratchet algorithm";
homepage = "https://github.com/Syndace/python-doubleratchet";
changelog = "https://github.com/Syndace/python-doubleratchet/blob/v${version}/CHANGELOG.md";
license = lib.licenses.mit;
maintainers = [];
};
}
70 changes: 70 additions & 0 deletions pkgs/by-name/helium/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
stdenv,
python3Packages,
lib,
fetchFromGitHub,
firefox,
geckodriver,
which,
}:
python3Packages.buildPythonPackage rec {
pname = "helium";
version = "5.1.0";
pyproject = true;

src = fetchFromGitHub {
owner = "mherrmann";
repo = "helium";
rev = "refs/tags/v${version}";
hash = "sha256-YV/X7BBzmX/4QL+YHJZrZPPsvZ2VheNHZiUrF/lUTW8=";
};

strictDeps = true;

nativeBuildInputs = with python3Packages; [setuptools];

propagatedBuildInputs = with python3Packages; [selenium];

nativeCheckInputs =
[
firefox
geckodriver
which
]
++ (with python3Packages; [
pytestCheckHook
]);

checkInputs = with python3Packages; [
psutil
];

# Selenium doesn't support testing on all setups
doCheck = stdenv.hostPlatform.isDarwin || (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86_64);

# Selenium setup
preCheck = ''
export HOME=$PWD
export TEST_BROWSER=firefox
export SE_OFFLINE=true
'';

disabledTestPaths = [
# All of the tests here fail, maybe because we force a driver to be found via envvars?
"tests/api/test_no_driver.py"

# New tests, not sure why they fail. Maybe due to forced firefox?
"tests/api/test_write.py"
];

pythonImportsCheck = [
"helium"
];

meta = {
description = "Lighter web automation with Python";
homepage = "https://github.com/mherrmann/helium";
license = lib.licenses.mit;
maintainers = [];
};
}
191 changes: 191 additions & 0 deletions pkgs/by-name/libervia-backend/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
{
stdenv,
python3Packages,
lib,
fetchFromGitHub,
fetchhg,
fetchPypi,
cmake,
doubleratchet,
firefox,
geckodriver,
gobject-introspection,
gst_all_1,
helium,
libervia-media,
libervia-templates,
libnice,
libsodium,
libxeddsa,
oldmemo,
omemo,
sat-tmp,
twomemo,
urwid-satext,
which,
wokkel,
wrapGAppsHook3,
writeScript,
x3dh,
xeddsa,
}:
python3Packages.buildPythonApplication rec {
pname = "libervia-backend";
version = "0.8.0-unstable-2024-10-26";
pyproject = true;

src = fetchhg {
url = "https://repos.goffi.org/libervia-backend";
rev = "00837fa13e5aafe40ef821eb73da5bde92ae9883";
hash = "sha256-D0iuwHJ277oxGySa8IltotwEPWCTssPehgQ9U0gYIK8=";
};

postPatch = let
# We need lib.getExe python3Packages.alembic's main, but with libervia modules available
# Workaround by declaring a script that runs alembic's main as part of libervia-backend's scripts
migrationScriptName = "libervia-migration-invoker";
in ''
# So backend can be started via dbus
substituteInPlace misc/org.libervia.Libervia.service \
--replace-fail 'Exec=libervia-backend' "Exec=$out/bin/libervia-backend"
# Needs a python interp with alembic & libervia available, call our invoker script instead which gets regular wrapping
substituteInPlace libervia/backend/memory/sqla.py \
--replace-fail 'sys.executable' '"${placeholder "out"}/bin/${migrationScriptName}"' \
--replace-fail '"-m",' "" \
--replace-fail '"alembic",' ""
substituteInPlace pyproject.toml \
--replace-fail '[project.scripts]' '[project.scripts]
${migrationScriptName} = "alembic.config:main"'
# Point at media content
substituteInPlace libervia/backend/core/constants.py \
--replace-fail '"media_dir": "/usr/share' '"media_dir": "${libervia-media}/share'
'';

strictDeps = true;

nativeBuildInputs =
[
gobject-introspection
wrapGAppsHook3
]
++ (with python3Packages; [
hatchling
setuptools-scm
pythonRelaxDepsHook
]);

buildInputs =
[libnice]
++ (with gst_all_1; [
gst-plugins-good # autoaudiosink
gst-plugins-bad # Namespace GstWebRTC not available
]);

pythonRelaxDeps = [
"dbus-python"
"html2text"
"lxml"
"progressbar2"
"treq"
"miniupnpc"
];

propagatedBuildInputs =
[
libervia-templates
sat-tmp
urwid-satext
wokkel
oldmemo
omemo
twomemo
]
++ (with python3Packages; [
aiosqlite
alembic
babel
cairosvg
cbor2
cryptography
dbus-python
emoji
gpgme
gst-python
html2text
jinja2
langid
lxml-html-clean
lxml
markdown
miniupnpc
mutagen
netifaces
oldmemo
pillow
potr
progressbar2
prompt-toolkit
pydantic
pygments
pygobject3
pyopenssl
python-dateutil
xlib
pyxdg
pyyaml
rich
setuptools
shortuuid
sqlalchemy
twisted
treq
txdbus
urwid
xmlschema
]);

nativeCheckInputs =
[
firefox
geckodriver
which
]
++ (with python3Packages; [pytestCheckHook]);

checkInputs =
[helium]
++ (with python3Packages; [
aiosmtpd
sh
pytest-twisted
]);

dontWrapGApps = true;

preFixup = ''
makeWrapperArgs+=("''${gappsWrapperArgs[@]}")
'';

# Selenium setup, need li on PATH
preCheck = ''
export HOME=$TEMP
export TEST_BROWSER=firefox
export SE_OFFLINE=true
export PATH=$out/bin:$PATH
'';

# Fairly sure these are bitrotten & not intended to be run anymore
disabledTestPaths = ["libervia/backend"];

meta = {
description = "Feature-rich XMPP client showcasing diverse frontends, uniting instant messaging, blogging, file sharing, and ActivityPub-XMPP interactions seamlessly";
homepage = "https://libervia.org/";
changelog = "https://repos.goffi.org/libervia-backend/file/${src.rev}/CHANGELOG";
license = lib.licenses.agpl3Plus;
maintainers = [];
};
}
44 changes: 44 additions & 0 deletions pkgs/by-name/libervia-media/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
stdenvNoCC,
lib,
fetchhg,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "libervia-media";
version = "0.8.0-unstable-2024-10-26";

src = fetchhg {
url = "https://repos.goffi.org/libervia-media";
rev = "aedac563c3f087d5cae4cb49322321906985ef45";
hash = "sha256-n1z1xgJi5D1raTgfiHpymAgdnfJ8eKT+zcW6Z/9ciBQ=";
};

dontBuild = true;

installPhase = ''
runHook preInstall
mkdir -p $out/share/libervia/media
cp -r * $out/share/libervia/media/
runHook postInstall
'';

meta = {
description = "Data files used by Libervia";
homepage = "https://libervia.org";
license = with lib.licenses; [
ofl # fonts
mit # fontawesome non-icons
cc-by-40 # fontawesome icons
gpl3Plus # split_card.sh
cc-by-sa-30 # tarot, quiz images; toolbar, menu, misc, libervia icons; vector icons
lgpl21Plus # crystal clear browser icons
cc-by-sa-40 # muchoslava icons
cc-by-30 # silk icons
publicDomain # tango icons
cc0 # notification sounds
# test audio claims it's from https://musopen.org/music/14914-hungarian-rhapsody-no-4-s-2444/ and publicDomain, but site has no audio?
];
};
})
30 changes: 30 additions & 0 deletions pkgs/by-name/libervia-templates/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
python3Packages,
lib,
fetchhg,
}:
python3Packages.buildPythonPackage rec {
pname = "libervia-templates";
version = "0.8.0-unstable-2024-10-26";
pyproject = true;

src = fetchhg {
url = "https://repos.goffi.org/libervia-templates";
rev = "2bbcb7da56bcaa213c709dd0cb9d5d5456e699d4";
hash = "sha256-DbP8VzCF2hOBf6F1saXoeWYHBT1vUFo4crx9s29S/u8=";
};

strictDeps = true;

nativeBuildInputs = with python3Packages; [hatchling];

# No tests, no modules to import check either
doCheck = false;

meta = {
description = "Templates for Libervia XMPP client";
homepage = "https://libervia.org";
license = lib.licenses.agpl3Plus;
maintainers = [];
};
}
Loading

0 comments on commit df8607b

Please sign in to comment.