Skip to content

feat(packaging): let store-based packages provide the desktop integrations - #1975

Merged
l0gicgate merged 1 commit into
mainfrom
feat/1969-package-integrations
Oct 31, 2026
Merged

l0gicgate merged 1 commit into
mainfrom
feat/1969-package-integrations

Conversation

@l0gicgate

Copy link
Copy Markdown
Contributor

Description

On Nix, wrapGAppsHook4 makes bin/strata a wrapper around bin/.strata-wrapped, and every store path changes on update. The runtime installers record /proc/self/exe, so the file chooser portal, FileManager1 service, Omarchy shortcuts, and udiskie hook end up pointing at the wrapped binary of one build: D-Bus-activated instances skip the wrapper's environment, and the next update or garbage collection leaves the files stale.

This adds the STRATA_INTEGRATIONS=package build switch (runtime is the default; any other value fails the build, like STRATA_UPDATER). With it set:

  • portal_setup::install/uninstall/install_file_manager/uninstall_file_manager/dismiss_prompt and udiskie::install/uninstall return a translated refusal, so --install-portal, --uninstall-portal, --dismiss-portal-prompt, --install-udiskie-unlock, and --uninstall-udiskie-unlock exit non-zero with that message, and Settings cannot trigger them.
  • The start-up refresh_stale_portal() and the post-update portal refresh are no-ops.
  • Settings → General → Desktop integration keeps the System file manager and Unlock encrypted volumes rows (so search still finds them) but each shows only a note that the package provides the integration, with no indicators or buttons.
  • The three new strings are translated in all thirteen catalogs.

The Nix package builds with the switch and gains two passthru derivations, fileChooserPortal (strata.portal plus its D-Bus service) and fileManagerService (the org.freedesktop.FileManager1 service), each with Exec pointing at ${strata}/bin/strata. They are separate from $out on purpose: NixOS registers every system package's share/dbus-1/services with the session bus, so shipping the FileManager1 service in the main package would make every install claim the bus name. nix flake check builds both. The README shows the NixOS xdg.portal.extraPortals / xdg.portal.config / services.dbus.packages options and the Home Manager xdg.mimeApps and services.udiskie.settings equivalents; docs/packaging.md documents the switch.

Paths reviewed and intentionally left alone, per the issue:

  • update_install.rs (desktop entry and icon cache refresh) is only reached through the in-place updater, which STRATA_UPDATER=disabled already compiles out.
  • The xdg-mime default folder association stores only the desktop ID and stays per-user; Home Manager users set xdg.mimeApps.defaultApplications.
  • PackageManager::detect() returns None on NixOS, so Settings → Integrations and Diagnostics show requirement chips without an install command, which is correct there. A Nix-specific hint is not part of this change.
  • --portal, --gapplication-service, and --udiskie-hook, which the shipped files invoke, are unchanged.

Visual evidence

N/A. The only visible change is in STRATA_INTEGRATIONS=package builds: the two Desktop integration rows show a title and a one-paragraph note instead of status indicators and the Complete setup / Restore default / Use Strata buttons.

How to test

  1. STRATA_INTEGRATIONS=package cargo run -- --install-portal and ... --install-udiskie-unlock: both print the refusal and exit 1 without writing under ~/.config or ~/.local/share.
  2. STRATA_INTEGRATIONS=package cargo run, open Settings → General, scroll to Desktop integration: both rows show the package note and no buttons; search for "desktop integration" still finds the row.
  3. A default build (cargo run) behaves as before: indicators, Complete setup and Restore default.
  4. With Nix: nix build .#strata.fileChooserPortal .#strata.fileManagerService and inspect result*/share; the Exec lines point at /nix/store/…-strata-<version>/bin/strata, not .strata-wrapped. nix flake check passes.

Expected result: package builds never write, remove, or refresh the integration files; the Nix derivations provide them, pointing at the wrapper.

Validation run locally: ./scripts/test-headless.py -- ui::portal_preferences::tests ui::udiskie_preferences::tests portal_setup::tests i18n:: build_info:: (47 passed, 1 pre-existing ignored), cargo fmt --check, cargo clippy --locked --all-targets --all-features -- -D warnings, and in a nixos/nix container: nix flake check --all-systems --no-build, nixfmt --check flake.nix package.nix, a full nix build of the package and both derivations, and the built binary's --install-portal / --install-udiskie-unlock refusals.

Related issue

Closes #1969

…tions

Add the STRATA_INTEGRATIONS=package build switch. With it set, the file
chooser portal, FileManager1 service, Omarchy shortcut, and udiskie unlock
installers refuse from Settings and the command line, the start-up stale
portal refresh is skipped, and the two Settings rows explain that the
package provides the integration. The Nix package builds that way and
exposes fileChooserPortal and fileManagerService derivations whose Exec
lines point at the package wrapper, so updates, rollbacks, and garbage
collection keep them in sync.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let store-based packages (Nix) provide the desktop integrations instead of the runtime installers

1 participant