Development and packaging
| Part | Path |
|---|---|
| Headless Rust core and CLI | crates/clamui-core |
| Tauri 2 desktop shell | desktop/src-tauri |
| React/TypeScript frontend | desktop/ |
| Docs website (Starlight) | website/ |
Python is not a build or runtime dependency. The v0.4.1 tag preserves the historical Python release; current work is on master.
Prerequisites
Section titled “Prerequisites”You need WebKitGTK 4.1 and GTK 3 development libraries, stable Rust from rustup, and Bun.
sudo apt updatesudo apt install build-essential pkg-config libssl-dev libgtk-3-dev \ libwebkit2gtk-4.1-dev librsvg2-dev libxdo-dev curl wget file \ flatpak-builderrustc --version && cargo --version && bun --versiongit clone https://github.com/linx-systems/clamui.gitcd clamuiFlatpak SDK for local Flatpak builds
The Flatpak recipes use GNOME Platform/SDK 51 and build for your native architecture (x86_64 or aarch64):
flatpak remote-add --if-not-exists --user flathub https://dl.flathub.org/repo/flathub.flatpakrepoflatpak install --user --arch="$(flatpak --default-arch)" flathub \ org.gnome.Sdk//51 \ org.freedesktop.Sdk.Extension.node24//26.08 \ org.freedesktop.Sdk.Extension.rust-stable//26.08Work on the app
Section titled “Work on the app”From the repository root, install the locked frontend dependencies and start Tauri:
( cd desktop && bun install --frozen-lockfile )bun run --cwd desktop tauri devUse the Tauri command for desktop development; do not substitute direct cargo run. Tauri development uses its configured build.devUrl, while the native custom-protocol production binary embeds frontendDist.
The GUI runs through Tauri/WebKitGTK. For the headless core CLI, use the native binary directly; this route must not initialize a WebKit window:
cargo run -p clamui-core --bin clamui-cli -- helpcargo run -p clamui-core --bin clamui-cli -- scan --helpcargo run -p clamui-core --bin clamui-scheduled-scan -- --dry-runThe clamui command preserves seven subcommands: scan, quarantine, profile, status, history, help, and install-privileged-helper. Keep their flags, JSON/text output, standard streams, and exit semantics compatible. clamui-scheduled-scan remains a separate executable.
The CLI accepts conventional bundled scan flags and compatible attached history arguments. Use -- before a target whose name looks like an option, for example clamui scan -- --virustotal; this keeps it a scan target rather than treating it as a flag.
The command-line reference explains how the installed binary chooses between CLI commands and graphical scans. Common commands:
clamui scan /path/to/targetclamui quarantine list --jsonclamui profile list --jsonclamui status --jsonclamui history --limit 20 --jsonclamui help scansudo clamui install-privileged-helperclamui-scheduled-scan --dry-runinstall-privileged-helper is the manual native/source-host path. Its real installation requires root and stages the co-bundled compiled helper with its canonical polkit policy; retain it for mutable source hosts. On supported Debian-family and Fedora hosts, a missing helper in native packages, AppImages, source builds, or Flatpak may show explicit in-app setup from the local capability check. Automatic setup requires an exact matching signed published package; before graphical Polkit authorization, it validates that package’s signature, identity, version, size, digest, and compatible architecture, otherwise failing safely without authorization. Debian alone can use its signed same-version architecture-independent fallback only when the release explicitly provides it and no exact-architecture helper exists. Fedora Atomic contributors must use verified RPM layering and reboot for manual repair, never this source installer against immutable /usr. The Flatpak rejects this host command, so do not use sudo flatpak.
For source-host development, build only the headless binaries, then use the non-privileged staging mode in a directory you own:
cargo build --locked -p clamui-core --binsstage_dir="$(mktemp -d)"./target/debug/clamui-cli install-privileged-helper --prefix "$stage_dir"On a mutable native host, the actual installation is a separate, privileged action; do not run Cargo as root:
sudo ./target/debug/clamui-cli install-privileged-helperDebugging
Section titled “Debugging”Use structured Rust logging while starting the desktop:
RUST_LOG=clamui=debug bun run --cwd desktop tauri devUse the Tauri/WebKit developer tools for frontend state and the terminal for Rust/core diagnostics. Never replace native IPC with a browser filesystem, shell, or process permission. The only frontend request boundary is Tauri’s allowlisted request command and clamui-event event stream.
Data compatibility
Section titled “Data compatibility”Work against the real XDG layout (locations), never project-local data. Preserve atomic settings writes, unknown keys, existing JSON/SQLite schemas, privacy migrations, restrictive file modes, and profile import compatibility. The core stays independent of GTK widgets and Tauri so everything also works through the CLI.
Host and privilege boundaries
Section titled “Host and privilege boundaries”- ClamUI uses host
clamscan,freshclam, and for daemon modeclamd/clamdscan. Flatpak calls crossflatpak-spawn --host. Never bundle or emulate ClamAV. - Protected config changes go through the protocol-v4 helper
/usr/bin/clamui-apply-preferencesand theio.github.linx_systems.ClamUI.policypolkit policy. Keep its allowlists,PKEXEC_UIDvalidation, exit codes, and compatibility with installed helpers. - Missing trust or authorization must fail without changes. User-facing behavior: privileged helper.
Test before a pull request
Section titled “Test before a pull request”bun run --cwd desktop checkbun run --cwd desktop build # before clippy: Tauri embeds desktop/distcargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo test --workspaceBeyond unit tests, exercise the real CLI: clean scan, EICAR, cancellation, clamui-scheduled-scan --dry-run, helper rejection, and CLI output compatibility. For desktop work, check startup, navigation, native dialogs, tray, and file-argument forwarding by hand.
File issues with the issue forms and describe what you actually verified in the pull request template.
Packaging
Section titled “Packaging”Packaging sources: debian/, flathub/, appimage/, rpm/. Use their scripts rather than recreating package logic.
| Format | Output | Architectures |
|---|---|---|
| Debian | App and helper .deb pair |
amd64, arm64 |
| Flatpak | Bundle or Flathub build | x86_64, aarch64 (a local build proves only your own) |
| AppImage | ClamUI-<VERSION>-x86_64.AppImage + .zsync |
x86_64 |
| Fedora RPM | Helper only | x86_64, aarch64 |
./debian/build-deb.sh# Package binaries built on the Ubuntu 22.04-compatible baseline:CLAMUI_ARTIFACT_DIR=/absolute/path/to/ubuntu22/target/release ./debian/build-deb.sh distUPDATE_INFORMATION='gh-releases-zsync|linx-systems|clamui|latest|ClamUI-*-x86_64.AppImage.zsync' ./appimage/build-appimage.shCLAMUI_ARTIFACT_DIR must contain executable clamui, clamui-scheduled-scan, and clamui-apply-preferences from the baseline build.
./rpm/build-privileged-helper-rpm.sh distCLAMUI_ARTIFACT_DIR=/absolute/path/to/ubuntu22/target/release CLAMUI_RPM_ARCH=x86_64 ./rpm/build-privileged-helper-rpm.sh distThe RPM build needs Cargo, readelf (binutils), rpm/rpmbuild, and for source builds the Rust C toolchain, pkg-config, and GLib headers. A local RPM is unsigned: the in-app installer only accepts the signed published one. CARGO_TARGET_DIR and CARGO_BUILD_TARGET pick a non-default artifact; CLAMUI_RPM_ARCH asserts the helper’s ELF architecture.
Dependabot and Flatpak sources
Section titled “Dependabot and Flatpak sources”Dependabot checks Cargo, the desktop and website Bun projects, and GitHub Actions weekly; minor and patch updates are grouped per project. desktop/bun.lock is canonical; desktop/yarn.lock is only its export for Flatpak’s offline source generator.
Cargo and desktop Dependabot PRs refresh the lockfile export and Flatpak sources automatically once the branch includes current master (comment @dependabot rebase on older PRs). To rerun it:
gh workflow run dependabot-refresh.yml --ref master -f pr_number=123( cd desktop && bun install --frozen-lockfile --yarn )scripts/generate-flatpak-sources.shFlatpak builds and Flathub releases
Section titled “Flatpak builds and Flathub releases”Local Flatpak checkout build
Section titled “Local Flatpak checkout build”flathub/io.github.linx_systems.ClamUI.local.yml builds your working tree. It does not install or replace an existing Flatpak:
mkdir -p targetflatpak_workdir="$(mktemp -d "$PWD/target/flatpak.XXXXXX")"flatpak-builder --user --arch="$(flatpak --default-arch)" \ --state-dir="$flatpak_workdir/state" \ --repo="$flatpak_workdir/repo" \ "$flatpak_workdir/build" \ flathub/io.github.linx_systems.ClamUI.local.ymlThe checked-in flathub/io.github.linx_systems.ClamUI.yml uses the same checkout source and is not a release manifest either.
Immutable Flatpak release packaging
Section titled “Immutable Flatpak release packaging”A release needs three inputs: a manifest pinned to a public Git URL and full commit, flathub/cargo-sources.json (from Cargo.lock), and flathub/bun-sources.json (from desktop/bun.lock via its Yarn export). Never hand-edit their checksums. Update one crate at a time with cargo update -p <crate> --precise <version>.
Generate and build a release manifest
Run from a clean checkout whose commit is already public. Needs flatpak-cargo-generator.py and flatpak-node-generator (Python 3.11+):
( cd desktop && bun install --frozen-lockfile --yarn )release_commit="$(git rev-parse HEAD)"scripts/generate-flatpak-sources.sh \ --release-url https://github.com/linx-systems/clamui.git \ --release-commit "$release_commit" \ --release-output flathub/io.github.linx_systems.ClamUI.release.ymlReview all three files together. Then build in a fresh directory:
mkdir -p targetflatpak_release_dir="$(mktemp -d "$PWD/target/flatpak-release.XXXXXX")"flatpak-builder --user --arch="$(flatpak --default-arch)" \ --state-dir="$flatpak_release_dir/state" \ --repo="$flatpak_release_dir/repo" \ "$flatpak_release_dir/build" \ flathub/io.github.linx_systems.ClamUI.release.ymlA local build proves only your architecture. Before submitting, validate offline builds for both x86_64 and aarch64. Store releases go through the separate Flathub repository; GitHub release bundles do not update Flathub. Inspect payloads for the right architecture, command names, helper and policy paths, and no Python runtime.
Write documentation
Section titled “Write documentation”Docs live in website/src/content/docs/docs/. Use root-relative /docs/.../ links, the existing sidebar, and Starlight components (rename a page to .mdx to use them). README.md and CONTRIBUTING.md stay short pointers; CHANGELOG.md and RELEASE_NOTES.md are rendered on the site.
( cd website && bun install --frozen-lockfile )bun run --cwd website checkbun run --cwd website buildDo not edit generated website/public/ or website/dist/. Catalog workflow: translation.
Update the application icon
Section titled “Update the application icon”icons/io.github.linx_systems.ClamUI.svg is the source; icons/io.github.linx_systems.ClamUI.png is its committed 128×128 rendering. Regenerate and commit both when the SVG changes.