id: io.github.plrigaux.sysd-manager
runtime: org.gnome.Platform
runtime-version: '49'
sdk: org.gnome.Sdk
sdk-extensions:
- org.freedesktop.Sdk.Extension.rust-stable
command: sysd-manager
finish-args:
- --share=ipc
- --socket=fallback-x11
- --socket=wayland
- --device=dri
# Needed to access /usr whre are located unit config files
- --filesystem=host-os
- --filesystem=host-etc
#- --filesystem=xdg-config
#- --filesystem=xdg-config/sysd-manager:rw
# Needed to access journal logs
- --filesystem=/var/log:ro
#- --env=RUST_LOG=info
#- --env=RUST_BACKTRACE=1
#- --env=SYSDMNG_DIST_MODE=flatpack
# Needed to talk to systemd1 with dbus
- --talk-name=org.freedesktop.systemd1
- --system-talk-name=org.freedesktop.systemd1

build-options:
  append-path: "/usr/lib/sdk/rust-stable/bin"
modules:
- name: sysd-manager
  buildsystem: simple
  build-options:
    env:
      CARGO_HOME: /run/build/sysd-manager/cargo
  build-commands:
  - cargo --offline fetch --manifest-path Cargo.toml --verbose
  - cargo --offline build --release --features flatpak
  - echo ""
  - echo Generating files
  - echo ""
  - cargo --offline run -p transtools -- packfiles
  - echo ""
  - install -Dm755 ./target/release/sysd-manager -t /app/bin/  
  - install -Dm644 ./data/icons/hicolor/scalable/apps/io.github.plrigaux.sysd-manager.svg -t /app/share/icons/hicolor/scalable/apps/
  - install -Dm644 ./data/schemas/io.github.plrigaux.sysd-manager.gschema.xml -t /app/share/glib-2.0/schemas
  - install -Dm644 ./target/loc/io.github.plrigaux.sysd-manager.desktop -t /app/share/applications
  - install -Dm644 ./target/loc/io.github.plrigaux.sysd-manager.metainfo.xml -t /app/share/metainfo
  # Copy Language Machine Objet (mo) files
  - cp -r ./target/locale /app/share/
  - glib-compile-schemas /app/share/glib-2.0/schemas

  sources:
  - type: dir
    path: "."
  - "cargo-sources.json"