app-id: io.github.aydiler.md-viewer runtime: org.freedesktop.Platform runtime-version: '24.08' sdk: org.freedesktop.Sdk sdk-extensions: - org.freedesktop.Sdk.Extension.rust-stable command: md-viewer finish-args: # Display servers - --socket=wayland - --socket=fallback-x11 - --share=ipc - --device=dri # Network is needed so HTTP image URLs in markdown render in the sandbox # (the README documents remote-image support, and shields.io badges, etc.). - --share=network # Read-only home access. A viewer never writes user files; it just needs # to read at arbitrary paths under $HOME for CLI invocation # (`md-viewer ~/notes/foo.md`), live reload via the notify watcher, and # files outside xdg-documents. Narrower than --filesystem=host:ro (no # /etc, /usr exposure) which the Flathub linter rejects. - --filesystem=home:ro - --filesystem=xdg-documents # No --talk-name for XDG portals — Flatpak apps reach FileChooser and # Desktop portals through the standard sandbox mechanism without an # explicit D-Bus talk-name (the linter flags those as unnecessary). build-options: append-path: /usr/lib/sdk/rust-stable/bin env: CARGO_HOME: /run/build/md-viewer/cargo modules: - name: md-viewer buildsystem: simple build-commands: # Strip the local-only MCP path dependency, mirroring CI. - | python3 - <<'PY' import pathlib, re p = pathlib.Path("Cargo.toml") t = p.read_text() t = t.replace('mcp = ["dep:egui-mcp-bridge"]', 'mcp = []') t = re.sub(r'(?m)^egui-mcp-bridge = .*\n', '', t) p.write_text(t) PY # Offline build using the vendored Cargo sources. - cargo --offline build --release --verbose # Install binary - install -Dm755 target/release/md-viewer /app/bin/md-viewer # Install license and third-party attribution notices - install -Dm644 LICENSE /app/share/licenses/md-viewer/LICENSE - install -Dm644 THIRD_PARTY_NOTICES /app/share/licenses/md-viewer/THIRD_PARTY_NOTICES # Install desktop file under the new app-id name - install -Dm644 data/md-viewer.desktop /app/share/applications/io.github.aydiler.md-viewer.desktop # Rewrite the Icon= line to reference our app-id icon - sed -i 's/^Icon=.*/Icon=io.github.aydiler.md-viewer/' /app/share/applications/io.github.aydiler.md-viewer.desktop # Install icon (256x256 hicolor) - install -Dm644 data/io.github.aydiler.md-viewer.png /app/share/icons/hicolor/256x256/apps/io.github.aydiler.md-viewer.png # Install AppStream metainfo - install -Dm644 data/io.github.aydiler.md-viewer.metainfo.xml /app/share/metainfo/io.github.aydiler.md-viewer.metainfo.xml sources: - type: git url: https://github.com/aydiler/md-viewer.git tag: v0.1.3 # Pinning to the tag's commit SHA satisfies Flathub linter and # prevents tag-rewrite drift from changing the build inputs. commit: 43d5efa8b68027df28124401839e86d13b4d1ee2 # Tells Flathub's update bot to watch for new tags after merge. x-checker-data: type: git tag-pattern: '^v([\d.]+)$' # Pre-resolved Cargo sources (generated with flatpak-cargo-generator.py). # Regenerate when Cargo.lock changes its transitive deps: # python3 flatpak-cargo-generator.py Cargo.lock -o flatpak/cargo-sources.json - cargo-sources.json