# yaml-language-server: $schema=https://raw.githubusercontent.com/flatpak/flatpak-builder/refs/heads/main/data/flatpak-manifest.schema.json # # Flatpak manifest for vernier. The app-id mirrors the live domain # (usevernier.com) — see https://docs.flathub.org/docs/for-app-authors/requirements # for why reverse-DNS of a domain you actually control is the safe # choice for Flathub publication. # # Built in CI by .github/workflows/release-flatpak.yml on every # published Release; the resulting .flatpak bundle is uploaded as a # Release asset for sideloading and for any future Flathub submission. app-id: com.usevernier.Vernier runtime: org.freedesktop.Platform runtime-version: "24.08" sdk: org.freedesktop.Sdk sdk-extensions: - org.freedesktop.Sdk.Extension.rust-stable - org.freedesktop.Sdk.Extension.llvm18 command: /app/bin/vernier build-options: append-path: "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm18/bin" prepend-ld-library-path: "/usr/lib/sdk/llvm18/lib" build-args: - "--share=network" env: # Sparse registry shaves multiple minutes off the cold dep # fetch — see https://blog.rust-lang.org/inside-rust/2023/01/30/cargo-sparse-protocol.html "CARGO_REGISTRIES_CRATES_IO_PROTOCOL": "sparse" "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER": "clang" # `-Wl,-z,now` forces immediate symbol resolution at load so # full-RELRO actually applies; combined with mold for link speed. "CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold -C link-arg=-Wl,-z,now" "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER": "clang" "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS": "-C link-arg=-fuse-ld=/usr/lib/sdk/rust-stable/bin/mold -C link-arg=-Wl,-z,now" # Permissions, in order of decreasing-blastradius: see # https://docs.flatpak.org/en/latest/sandbox-permissions.html for # what each one grants. Tighten as we learn more about vernier's # real runtime needs. finish-args: # Wayland is the primary target; X11 is the documented fallback. - "--socket=wayland" - "--socket=fallback-x11" # The optional Figma Community plugin reports its viewport zoom to # Vernier over a loopback-only WebSocket (127.0.0.1:8765). Flatpak # does not expose a narrower loopback permission, so runtime network # sharing is required for that local companion connection. - "--share=network" # GPU access for the overlay renderer (wgpu / winit need DRI). - "--device=dri" # ipc share is required alongside fallback-x11 — the X11 server # uses shared memory; without --share=ipc the fallback path # silently fails with cryptic XSHM errors on some hosts. - "--share=ipc" # Where measurement screenshots and exports land. - "--filesystem=xdg-pictures" # Per-app scope so a sandbox escape can't read every other app's # config; vernier writes settings.toml and screencast.token to # `$XDG_CONFIG_HOME/vernier/` (see crates/vernier-core/src/settings.rs # and crates/vernier-platform/src/linux/screencast.rs). - "--filesystem=xdg-config/vernier:rw" # Enter on a measurement copies the value to the system # clipboard — needs the Clipboard portal to write the selection. - "--talk-name=org.freedesktop.portal.Clipboard" # Capture-saved / hand-off toasts use the Notifications portal; # without this they'd be silently swallowed by the sandbox. - "--talk-name=org.freedesktop.Notifications" # Fresh captures use grim through the Wayland socket. The background # screencast uses xdg-desktop-portal, which the sandbox auto-allows. - "--env=RUST_BACKTRACE=1" modules: # Fresh Wayland activation captures use wlr-screencopy, not the portal cache. - name: grim buildsystem: meson config-opts: - -Dman-pages=disabled - -Djpeg=disabled sources: - type: archive url: https://gitlab.freedesktop.org/emersion/grim/-/archive/v1.5.0/grim-v1.5.0.tar.gz sha256: 9e72a98f7621b1f5741b405b8dbd447acf7d300ddb12667ec526db1ce6154eaa - name: vernier buildsystem: simple build-options: build-args: - "--share=network" append-path: /usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm18/bin env: CARGO_HOME: /run/build/vernier/cargo build-commands: - cargo fetch --manifest-path Cargo.toml --verbose - cargo build --release --bin vernier - install -Dm0755 target/release/vernier /app/bin/vernier - install -Dm0644 assets/icons/hicolor/scalable/apps/vernier.svg ${FLATPAK_DEST}/share/icons/hicolor/scalable/apps/${FLATPAK_ID}.svg # Render a hicolor PNG ladder from the source SVG so hosts # that prefer fixed-size raster icons (older toolkits, certain # KDE variants) get a sharp render without scaling the SVG at # runtime. rsvg-convert ships with the freedesktop runtime. - | for size in 16 22 24 32 48 64 128 256 512; do install -d ${FLATPAK_DEST}/share/icons/hicolor/${size}x${size}/apps rsvg-convert -w $size -h $size \ assets/icons/hicolor/scalable/apps/vernier.svg \ -o ${FLATPAK_DEST}/share/icons/hicolor/${size}x${size}/apps/${FLATPAK_ID}.png done - install -Dm0644 packaging/vernier.desktop ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop # The shipped desktop file uses `Icon=vernier` and `Exec=vernier prefs` # because that's how it's consumed in non-Flatpak contexts # (the AUR tarballs install the binary at /usr/bin/vernier # and the icon as vernier.svg). Inside the Flatpak sandbox, # the icon is installed as ${FLATPAK_ID}.svg and the binary # at /app/bin/vernier, so the desktop file's Icon= and Exec= # are rewritten here at install time to match — without this, # the icon shows a generic placeholder in GNOME Software / # KDE Discover and clicks may fail to launch. - sed -i 's|^Icon=vernier$|Icon=com.usevernier.Vernier|' ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop - sed -i 's|^Exec=vernier |Exec=/app/bin/vernier |' ${FLATPAK_DEST}/share/applications/${FLATPAK_ID}.desktop # AppStream metainfo — required by Flathub, also picked up by # GNOME Software / KDE Discover for sideloaded bundles. - install -Dm0644 build-aux/com.usevernier.Vernier.metainfo.xml ${FLATPAK_DEST}/share/metainfo/${FLATPAK_ID}.metainfo.xml sources: - type: dir path: ..