feat: supported flatpak

This commit is contained in:
kogeletey
2024-01-25 14:48:18 +03:00
parent 763ace5ddf
commit 4a99eb94e2
9 changed files with 340 additions and 84 deletions

View File

@@ -0,0 +1,13 @@
diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json
index 21f5d9a5..9a46f36d 100644
--- a/src-tauri/tauri.conf.json
+++ b/src-tauri/tauri.conf.json
@@ -64,7 +64,7 @@
"shortDescription": "",
"targets": "all",
"updater": {
- "active": true,
+ "active": false,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEU3OTdCMkM3RjU5QzE2NzkKUldSNUZwejF4N0tYNTVHYjMrU0JkL090SlEyNUVLYU5TM2hTU3RXSWtEWngrZWJ4a0pydUhXZHEK",
"windows": {
"installMode": "quiet"

70
flatpak/Containerfile Normal file
View File

@@ -0,0 +1,70 @@
FROM node:20-slim as prepare
RUN apt update && apt install -y git
# Taken from tauri docs https://beta.tauri.app/guides/prerequisites/#rust
RUN apt install libwebkit2gtk-4.1-dev -y \
build-essential \
curl \
wget \
file \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
FROM prepare as build
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV PATH="/root/.cargo/bin:${PATH}"
#RUN corepack prepare pnpm@latest --activate
RUN corepack enable
ADD src /lume/src
ADD public /lume/public
ADD index.html \
package.json \
postcss.config.js \
tailwind.config.js \
vite.config.ts \
pnpm-lock.yaml \
tsconfig.json \
/lume
ADD src-tauri/icons /lume/src-tauri/icons
ADD src-tauri/migrations /lume/src-tauri/migrations
ADD src-tauri/src /lume/src-tauri/src
ADD src-tauri/build.rs \
src-tauri/Cargo.lock \
src-tauri/Cargo.toml \
src-tauri/tauri.conf.json \
src-tauri/tauri.linux.conf.json \
/lume/src-tauri
WORKDIR /lume
RUN pnpm install --frozen-lockfile
# Path for disable updater
ADD flatpak/0001-disable-tauri-updater.patch .
RUN patch -p1 -t -i 0001-disable-tauri-updater.patch
# debian build
RUN pnpm tauri build -b deb
ARG VERSION=2.2.3
ARG ARCH=amd64
RUN cp -r ./src-tauri/target/release/bundle/deb/lume_${VERSION}_${ARCH}/data lume-package
FROM scratch as final
COPY --from=build lume/lume-package prepare-dist
#ADD flatpak/*.xml flatpak/*.desktop flatpak/*.yml prepare-dist

14
flatpak/README.md Normal file
View File

@@ -0,0 +1,14 @@
# Lume nostr desktop client
[GitHub - luminous-devs/lume: A cross-platform desktop nostr client](https://github.com/luminous-devs/lume) is made with Tauri and built using [pnpm](https://pnpm.io) and [cargo](https://doc.rust-lang.org/cargo/) packages.
Lume itself has node dependencies managed with pnpm as well.
## Source generation
To transform their package locks into flatpak sources, [flatpak-builder-tools](https://github.com/flatpak/flatpak-builder-tools) is used.
```sh
# Generate cinny-desktop sources for use with cargo
<path-to flatpak-builder-tools>/cargo/flatpak-cargo-generator.py -o cargo-sources.json <path-to cinny-desktop>/src-tauri/Cargo.lock
# Generate cinny and cinny-desktop sources for use with npm
flatpak-node-generator --no-requests-cache -r -o node-sources.json npm <path-to cinny-desktop>/package-lock.json
```

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>nu.lume.Lume</id>
<launchable type="desktop-id">nu.lume.Lume.desktop</launchable>
<name>Lume</name>
<summary>A cross-platform desktop nostr client</summary>
<developer_name>Ren Amamiya</developer_name>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-only</project_license>
<url type="homepage">https://lume.nu</url>
<url type="bugtracker">https://github.com/luminous-devs/lume/issues</url>
<url type="donation">https://nostree.me/npub1zfss807aer0j26mwp2la0ume0jqde3823rmu97ra6sgyyg956e0s6xw445</url>
<supports>
<control>pointing</control>
<control>keyboard</control>
<control>touch</control>
</supports>
<description>
<p>
Lume a cross-platform nostr client, supported nsbunker, chats and notifications
</p>
</description>
<custom>
<value key="Purism::form_factor">workstation</value>
<value key="Purism::form_factor">mobile</value>
</custom>
<releases>
<release version="2.2.3" date="2023-12-07"/>
</releases>
<content_rating type="oars-1.1"/>
</component>

View File

@@ -0,0 +1,12 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=Lume
Comment=A cross-platform desktop nostr client
Icon=lume
Exec=lume
Terminal=false
Categories=Network;InstantMessaging;
Keywords=nostr;client;chat;
X-Purism-FormFactor=Workstation;

38
flatpak/nu.lume.Lume.yml Normal file
View File

@@ -0,0 +1,38 @@
id: nu.lume.Lume
runtime: org.gnome.Platform
runtime-version: '45'
sdk: org.gnome.Sdk
command: lume
rename-icon: lume
finish-args:
- --socket=wayland
- --socket=fallback-x11
- --socket=pulseaudio
- --share=ipc
- --share=network
#- --filesystem=home
#- --filesystem=xdg-download
#- --talk-name=org.freedesktop.secrets
- --talk-name=org.freedesktop.Notifications
- --talk-name=org.kde.StatusNotifierWatcher
- --filesystem=xdg-run/keyring
- --device=dri
modules:
- name: lume
sources:
- type: dir
path: usr
- type: file
path: nu.lume.Lume.desktop
- type: file
path: nu.lume.Lume.appdata.xml
buildsystem: simple
build-commands:
- install -Dm755 bin/lume /app/bin/lume
- mkdir -p /app/share/icons/hicolor/
- cp -r share/icons/hicolor/ /app/share/icons/
- install -Dm644 nu.lume.Lume.appdata.xml /app/share/metainfo/nu.lume.Lume.appdata.xml
- install -Dm644 nu.lume.Lume.desktop /app/share/applications/nu.lume.Lume.desktop
- ls -lRa /app