# flake.nix — Lumo Desktop (Proton's privacy-first AI assistant) for Nix # # Upstream: https://github.com/ProtonLumo/lumo-desktop (Tauri v2, GPL-3.0) # # "Always current master": `nix flake update lumo-src` advances the lock. # # THE CRITICAL FINDING: # src-tauri/src/lib.rs defines the web app URL as a COMPILE-TIME # constant: option_env!("LUMO_URL") with default # "https://lumo.proton.dev" — Proton's INTERNAL DEV environment. # Building from the public repo without injection therefore talks to # the dev endpoint, whose certificate the system trust store rightly # rejects ("Unacceptable TLS certificate"). Production builds get # LUMO_URL injected in Proton's internal CI. We do the same via the # derivation environment (option_env! reads it at compile time). # # RUNTIME PIECES (all verified necessary step by step): # * libayatana-appindicator on LD_LIBRARY_PATH (tray dlopen) # * glib-networking in buildInputs — GIO's gnutls TLS backend for # WebKitGTK HTTPS (confirmed loaded in G_MESSAGES_DEBUG logs); # wrapGAppsHook exports GIO_EXTRA_MODULES, that suffices # * cacert bundle exported for any OpenSSL-style consumers # * GIO_MODULE_DIR experiment REMOVED — the backend was found # without it; --set would have hidden other GIO modules. # # VERIFIED (GitHub file tree + README + build/run logs, branch master): # * src-tauri/Cargo.toml, src-tauri/Cargo.lock committed # * webview npm script: `npm run build:webview` — builds fine offline # * upstream version from package.json (currently 0.5.9) # * updater WARN (missing "linux-x86_64" platform) was a symptom of # the dev endpoint; should disappear with the production URL. { description = "Lumo Desktop, Proton's privacy-first AI assistant (Tauri)"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; # Tracks upstream master; lock pins the last-updated commit. lumo-src = { url = "github:ProtonLumo/lumo-desktop"; flake = false; }; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, lumo-src, flake-utils }: flake-utils.lib.eachDefaultSystem (system: let pkgs = import nixpkgs { inherit system; }; upstreamVersion = (builtins.fromJSON (builtins.readFile "${lumo-src}/package.json")).version; version = "${upstreamVersion}-master-${builtins.substring 0 8 lumo-src.lastModifiedDate or "unknown"}"; src = lumo-src; lumoBuildInputs = with pkgs; [ gtk3 webkitgtk_4_1 glib-networking # GIO TLS module (gnutls backend) for the # webview's HTTPS at runtime libsoup_3 glib cairo pango gdk-pixbuf atk librsvg openssl aws-lc # system AWS-LC: satisfies aws-lc-sys USE_SYSTEM=1 libayatana-appindicator # tray icon lib, dlopen'ed at runtime dbus libsecret gsettings-desktop-schemas hicolor-icon-theme ]; lumo-desktop = pkgs.rustPlatform.buildRustPackage { pname = "lumo-desktop"; inherit version src; # Injected into the build env; lib.rs reads it via option_env! # at compile time. Use the PRODUCTION web app, not the public # repo's dev default (lumo.proton.dev). LUMO_URL = "https://lumo.proton.me"; cargoRoot = "src-tauri"; buildAndTestSubdir = "src-tauri"; cargoLock.lockFile = "${src}/src-tauri/Cargo.lock"; cargoLock.outputHashes = { }; npmDeps = pkgs.fetchNpmDeps { inherit src; hash = "sha256-GqCjpQWj7d342yqs+H+1ckIgnVMx9wNDeET0uwQP0pM="; }; nativeBuildInputs = with pkgs; [ pkg-config nodejs pkgs.npmHooks.npmConfigHook wrapGAppsHook3 ]; buildInputs = lumoBuildInputs; doCheck = false; # e2e suite needs a WebKitGTK container preConfigure = '' export HOME=$TMPDIR npm ci --ignore-scripts npm run build:webview if [ ! -e src-tauri/dist ]; then echo "ERROR: src-tauri/dist missing after build:webview." exit 1 fi ''; preFixup = '' gappsWrapperArgs+=( # Tray lib for the runtime dlopen: --prefix LD_LIBRARY_PATH : "${pkgs.lib.makeLibraryPath [ pkgs.libayatana-appindicator ]}" # CA trust store for any OpenSSL-style consumers: --set SSL_CERT_FILE "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" --set NIX_SSL_CERT_FILE "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" ) ''; postInstall = '' # TODO: src-tauri/linux/ ships prebuilt bundle metadata — # prefer its .desktop/icons over this hand-written entry # after inspecting the directory. mkdir -p $out/share/applications mkdir -p $out/share/icons/hicolor/512x512/apps install -Dm644 src-tauri/icons/icon.png \ $out/share/icons/hicolor/512x512/apps/lumo.png || true cat > $out/share/applications/me.proton.lumo-app.desktop <