From 5c29063131d9203eb60814898ba4af77914a0c4a Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Tue, 17 Nov 2026 21:19:23 +0100 Subject: init --- .gitignore | 1 + flake.lock | 78 +++++++++++++++++++++++++ flake.nix | 190 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ result | 1 + 4 files changed, 270 insertions(+) create mode 100644 .gitignore create mode 100644 flake.lock create mode 100644 flake.nix create mode 120000 result diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1cd791b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +result/ diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6edbb5f --- /dev/null +++ b/flake.lock @@ -0,0 +1,78 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1794427683, + "narHash": "sha256-o7ey9gEilsxaifqJWnBDlYSKbNWYQYtKwDyXeZU2kaU=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cd489559845d81f673a12885576016c65cbe9363", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "lumo-src": { + "flake": false, + "locked": { + "lastModified": 1794908321, + "narHash": "sha256-sOvwsJWwDZiBQlaKERQgPGZzbWNjxTCs63aYsqYS8O8=", + "owner": "ProtonLumo", + "repo": "lumo-desktop", + "rev": "bd5e2c608bac61f215d4a2094e26ef88cb7bc1e0", + "type": "github" + }, + "original": { + "owner": "ProtonLumo", + "repo": "lumo-desktop", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1794537146, + "narHash": "sha256-Wpz/7x/YWnDIBu7yj6ixe8j6fIMsidd9Y+o1PqPF3iM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d5cc6833999746cffdfe0598f7bc801a57b887a9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "lumo-src": "lumo-src", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1791244623, + "narHash": "sha256-uuanbkFk8a313Zfrxdcz8Us/yQtaxNnKJtX8v0ZPpd8=", + "owner": "nix-systems", + "repo": "default", + "rev": "d36eeed142f88b5a636f2e3856a53c61654cf29b", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..6158d53 --- /dev/null +++ b/flake.nix @@ -0,0 +1,190 @@ +# 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 <