newelle: ship on moby, hack in cross compilation

This commit is contained in:
2025-07-24 07:03:40 +00:00
parent c2ab6748c4
commit 32946c35d9
4 changed files with 63 additions and 2 deletions

View File

@@ -350,6 +350,7 @@ in
"mpv" "mpv"
"networkmanagerapplet" "networkmanagerapplet"
# "ntfy-sh" # notification service # "ntfy-sh" # notification service
"newelle" # ollama/LLM client
"newsflash" # RSS viewer "newsflash" # RSS viewer
"papers" # PDF viewer "papers" # PDF viewer
"pavucontrol" "pavucontrol"
@@ -433,7 +434,6 @@ in
# "makemkv" # x86-only # "makemkv" # x86-only
# "monero-gui" # x86-only # "monero-gui" # x86-only
"mumble" "mumble"
"newelle" # ollama/LLM client
# "nheko" # Matrix chat client # "nheko" # Matrix chat client
"nicotine-plus" # soulseek client "nicotine-plus" # soulseek client
# "obsidian" # "obsidian"

View File

@@ -3,10 +3,45 @@
# to decrease pathologies # to decrease pathologies
# - intelligent formatting of model output (e.g. latex, markdown) # - intelligent formatting of model output (e.g. latex, markdown)
# #
# shortcomings (as of 2025-07-23):
# - poorly adapts to very narrow screens.
# - usable, but e.g. the "post" button (and the window close button) is cut off
# - closing the UI does not fully exit the process
# - presumably it's sitting in the background, waiting to be dbus-activated
#
# TODO: configure ollama connection details statically # TODO: configure ollama connection details statically
{ ... }: { pkgs, ... }:
{ {
sane.programs.newelle = { sane.programs.newelle = {
packageUnwrapped = (pkgs.newelle.override {
python3Packages = pkgs.python3Packages // {
# XXX(2025-07-23): these don't cross compile; disable them
# pydub drags in opencv, but only used for text-to-speech (and only for Newelle <= 0.9.8)
pydub = null;
# speechrecognition has a build error due to python3Packages.standard-aifc > python3Packages.audioop
speechrecognition = null;
# both of these are blocked on `python3Packages.spacy`
# llama-index-* is imported, lazily, from handlers/rag/llamaindex_handler.py
llama-index-core = null;
llama-index-readers-file = null;
};
}).overridePythonAttrs (upstream: {
postPatch = (upstream.postPatch or "") + ''
# patch out the toplevel speech_recognition imports so that the app
# is launchable without it.
# actually trying to use speech recognition will (likely) manifest as a runtime error, instead.
find . -exec sed -i 's/import speech_recognition/# import speech_recognition/g' '{}' ';'
# turn pydub (text-to-speech) into a runtime error.
# N.B.: remove once Newelle is upgraded past 0.9.8:
# future versions do not use pydub for tts (but ffplay instead)
substituteInPlace src/handlers/tts/tts.py \
--replace-fail 'from pydub' '# from pydub'
'';
});
buildCost = 2; #< liable to break cross during updates; not important enough to block deploy over
sandbox.net = "all"; # maybe only needs wireguard, actually sandbox.net = "all"; # maybe only needs wireguard, actually
sandbox.whitelistWayland = true; sandbox.whitelistWayland = true;
sandbox.mesaCacheDir = ".cache/Newelle/mesa"; sandbox.mesaCacheDir = ".cache/Newelle/mesa";

View File

@@ -588,6 +588,25 @@ in with final; {
cargo = crossCargo; cargo = crossCargo;
}; };
# pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
# (pyself: pysuper: {
# # 2025/07/23: upstreaming is unblocked, but solution is untested.
# # the references here are a result of the cython build process.
# # cython is using the #include files from the build python, and leaving those paths in code comments.
# # better solution is to get cython to use the HOST python??
# #
# # python3Packages.srsly is required by `newelle` program.
# srsly = pysuper.srsly.overridePythonAttrs (upstream: {
# nativeBuildInputs = (upstream.nativeBuildInputs or []) ++ [
# removeReferencesTo
# ];
# postFixup = (upstream.postFixup or "") + ''
# remove-references-to -t ${pyself.python.pythonOnBuildForHost} $out/${pyself.python.sitePackages}/srsly/msgpack/*.cpp
# '';
# });
# })
# ];
# qt6 = prev.qt6.overrideScope (self: super: { # qt6 = prev.qt6.overrideScope (self: super: {
# # qtbase = super.qtbase.overrideAttrs (upstream: { # # qtbase = super.qtbase.overrideAttrs (upstream: {
# # # cmakeFlags = upstream.cmakeFlags ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ # # # cmakeFlags = upstream.cmakeFlags ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [

View File

@@ -64,6 +64,13 @@ in
hash = "sha256-609snDT1Ru69ZTWfzu4PnhY0pj3xghPr8w880j7JZ5k="; hash = "sha256-609snDT1Ru69ZTWfzu4PnhY0pj3xghPr8w880j7JZ5k=";
}) })
# (fetchpatch' {
# # opencv used by alpaca, newelle
# name = "opencv: fix cross compliation by patching protobuf";
# prUrl = "https://github.com/NixOS/nixpkgs/pull/415591";
# hash = "sha256-ZTTIw10Nh179JrAudSuC8FDTSW2CspYrRchMi+ODwww=";
# })
# (fetchpatch' { # (fetchpatch' {
# # XXX(2025-01-06): patch does not produce valid binaries for cross # # XXX(2025-01-06): patch does not produce valid binaries for cross
# name = "lua-language-server: fix cross compiling"; # name = "lua-language-server: fix cross compiling";