app-id: io.github.cosmic_utils.camera runtime: org.freedesktop.Platform runtime-version: '25.08' sdk: org.freedesktop.Sdk sdk-extensions: - org.freedesktop.Sdk.Extension.rust-stable - org.freedesktop.Sdk.Extension.llvm21 base: com.system76.Cosmic.BaseApp base-version: stable command: camera finish-args: # Wayland access - --socket=wayland # X11 Fallback - --share=ipc - --socket=fallback-x11 # Webcam access (currently no better option than this) # https://docs.flatpak.org/en/latest/sandbox-permissions.html#device-access # Automatically includes GPU support since "dri" is part of "all" - --device=all # Home directory access for saving photos/videos - --filesystem=xdg-pictures:rw - --filesystem=xdg-videos:rw # flathub-linter: skip=finish-args-unnecessary-xdg-config-cosmic-rw-access - --filesystem=xdg-config/cosmic:rw # PipeWire access for camera and audio - --filesystem=xdg-run/pipewire-0:ro # PulseAudio access (PipeWire's PulseAudio compatibility layer for pulsesrc) - --socket=pulseaudio # udev access for libcamera device enumeration (reads device metadata) - --filesystem=/run/udev:ro # D-Bus access for COSMIC config daemon (live theme/config updates) # The wildcard is needed because the settings daemon creates dynamic config proxy # names like com.system76.CosmicSettingsDaemon.Config.com.system76.CosmicTheme.Dark.V1 - --talk-name=com.system76.CosmicSettingsDaemon - --talk-name=com.system76.CosmicSettingsDaemon.* # D-Bus access for "Show in Files" functionality - --talk-name=org.freedesktop.FileManager1 # D-Bus access for WiFi connection from QR codes (system bus, not session bus) - --system-talk-name=org.freedesktop.NetworkManager modules: # Python build dependencies required by libcamera's meson build. # The Freedesktop SDK includes markupsafe but not jinja2/pyyaml, which # libcamera needs for code generation during its meson configure step. # flit_core is needed as the build backend for jinja2. - name: python3-flit-core buildsystem: simple build-commands: - pip3 install --no-build-isolation --prefix=${FLATPAK_DEST} . sources: - type: archive url: https://files.pythonhosted.org/packages/69/59/b6fc2188dfc7ea4f936cd12b49d707f66a1cb7a1d2c16172963534db741b/flit_core-3.12.0.tar.gz sha256: 18f63100d6f94385c6ed57a72073443e1a71a4acb4339491615d0f16d6ff01b2 - name: python3-jinja2 buildsystem: simple build-commands: - pip3 install --no-build-isolation --prefix=${FLATPAK_DEST} . sources: - type: archive url: https://files.pythonhosted.org/packages/df/bf/f7da0350254c0ed7c72f3e33cef02e048281fec7ecec5f032d4aac52226b/jinja2-3.1.6.tar.gz sha256: 0137fb05990d35f1275a587e9aee6d56da821fc83491a0fb838183be43f66d6d - name: python3-pyyaml buildsystem: simple build-commands: - pip3 install --no-build-isolation --prefix=${FLATPAK_DEST} . sources: - type: archive url: https://files.pythonhosted.org/packages/05/8e/961c0007c59b8dd7729d542c61a4d537767a59645b82a0b521206e1e25c2/pyyaml-6.0.3.tar.gz sha256: d76623373421df22fb4cf8817020cbb7ef15c725b9d5e45f17e189bfc384190f - name: python3-ply buildsystem: simple build-commands: - pip3 install --no-build-isolation --prefix=${FLATPAK_DEST} . sources: - type: archive url: https://files.pythonhosted.org/packages/e5/69/882ee5c9d017149285cab114ebeab373308ef0f874fcdac9beb90e0ac4da/ply-3.11.tar.gz sha256: 00c7c1aaa88358b9c765b6d3000c6eec0ba42abca5351b095321aef446081da3 # nlohmann/json header-only library, needed by libpisp - name: nlohmann-json buildsystem: cmake-ninja config-opts: - -DJSON_BuildTests=OFF sources: - type: git url: https://github.com/nlohmann/json.git tag: v3.12.0 commit: 65ee68451d8eb2b5f3a30b410476ab83deb3289b # libpisp is needed by libcamera's Raspberry Pi ISP pipeline handler - name: libpisp buildsystem: meson sources: - type: git url: https://github.com/raspberrypi/libpisp.git tag: v1.3.0 commit: 9ba67e6680f03f31f2b1741a53e8fd549be82cbe # Build libcamera from source so the Rust crate can link against it via pkg-config. - name: libcamera buildsystem: meson config-opts: - -Dcam=disabled - -Dqcam=disabled - -Dgstreamer=disabled - -Dtracing=disabled - -Dpycamera=disabled - -Dlc-compliance=disabled - -Ddocumentation=disabled - -Dtest=false sources: - type: git url: https://github.com/FreddyFunk/libcamera.git branch: sandbox-ipa-fallback commit: b16952df91907858c6d8e646b65478938a91ce08 - name: camera buildsystem: simple build-options: append-path: /usr/lib/sdk/rust-stable/bin env: CARGO_HOME: /run/build/camera/cargo CARGO_TARGET_DIR: /run/build/camera/target LIBCLANG_PATH: /usr/lib/sdk/llvm21/lib BINDGEN_EXTRA_CLANG_ARGS: -I/usr/lib/sdk/llvm21/lib/clang/21/include # libcamera installs to lib64 on x86_64, but flatpak's default # PKG_CONFIG_PATH only includes lib/pkgconfig PKG_CONFIG_PATH: /app/lib64/pkgconfig:/app/lib/pkgconfig:/app/share/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig build-commands: # Build the application with cargo (version is passed via .flatpak-version file) - | if [ -f .flatpak-version ]; then export CAMERA_VERSION=$(cat .flatpak-version) fi cargo --offline fetch --manifest-path Cargo.toml --verbose cargo --offline build --release --verbose # Install the binary - install -Dm755 target/release/camera -t /app/bin/ # Install desktop file - install -Dm644 resources/io.github.cosmic_utils.camera.desktop -t /app/share/applications/ # Install icons (PNG for each size, SVG for scalable) - install -Dm644 resources/icons/hicolor/scalable/apps/io.github.cosmic_utils.camera.svg -t /app/share/icons/hicolor/scalable/apps/ - install -Dm644 resources/icons/hicolor/16x16/apps/io.github.cosmic_utils.camera.png -t /app/share/icons/hicolor/16x16/apps/ - install -Dm644 resources/icons/hicolor/24x24/apps/io.github.cosmic_utils.camera.png -t /app/share/icons/hicolor/24x24/apps/ - install -Dm644 resources/icons/hicolor/32x32/apps/io.github.cosmic_utils.camera.png -t /app/share/icons/hicolor/32x32/apps/ - install -Dm644 resources/icons/hicolor/48x48/apps/io.github.cosmic_utils.camera.png -t /app/share/icons/hicolor/48x48/apps/ - install -Dm644 resources/icons/hicolor/64x64/apps/io.github.cosmic_utils.camera.png -t /app/share/icons/hicolor/64x64/apps/ - install -Dm644 resources/icons/hicolor/128x128/apps/io.github.cosmic_utils.camera.png -t /app/share/icons/hicolor/128x128/apps/ - install -Dm644 resources/icons/hicolor/256x256/apps/io.github.cosmic_utils.camera.png -t /app/share/icons/hicolor/256x256/apps/ # Install metainfo - install -Dm644 resources/io.github.cosmic_utils.camera.metainfo.xml -t /app/share/metainfo/ sources: - type: dir path: . - cargo-sources.json # Note: No additional GStreamer plugins needed - app uses pipewiresrc which is # included in org.freedesktop.Platform via PipeWire's gst-plugin-pipewire