gmodena / nix-flatpak

Install flatpaks declaratively
Apache License 2.0
334 stars 10 forks source link

Bug | Home Manager Module | Flatpaks Fail to Launch When Only Home Manager Module is Installed #33

Open ReedClanton opened 9 months ago

ReedClanton commented 9 months ago

Description

Some flatpaks fail to launch when installed due to lacking access to /var/lib/flatpak/repo when they've been installed via nix-flatpak with the Home Manager module. This can be fixed by installing at least one flatpak system wide via the nix-flatpak NixOS module.

Reproduce

  1. Start from a fresh system that's never had flatpak, any flatpak application, or any nix-flatpak module installed.
  2. Run sudo nixos-rebuild switch --flake <pathToFlake> with only the Home Manager module of nix-flatpak installed.
  3. Install com.github.tchx84.Flatseal, cc.arduino.IDE2, and com.valvesoftware.Steam via nix-flatpak's Home Manager module.
  4. Launch Flatseal with flatpak run --user com.github.tchx84.Flatseal and verify that it launches as it should. This is an example of a flatpak that functions as it should.
  5. Launch Arduino IDE 2 with flatpak run --user cc.arduino.IDE2 and verify that it produces the bellow output, hangs, and fails to launch a GUI:
error: While opening repository /var/lib/flatpak/repo: opening repo: opendir(/var/lib/flatpak/repo): No such file or directory
[3 preload-host-spawn-strategy] Failed to let stub process know of exit: Bad file descriptor (errno 9)
  1. Launch Arduino IDE 2 again with the same command and verify that it exhibits the same behavior.

  2. Launch Steam with flatpak run --user com.valvesoftware.Steam and verify that it produces the bellow output and exists (note, I think only the last line is relevant to this issue):

INFO:root:https://github.com/flathub/com.valvesoftware.Steam/wiki
ERROR:root:~/.steam/root isn't a symlink to an existing directory, cannot determine current prefix
INFO:root:Will set XDG dirs prefix to /home/reedclanton/.var/app/com.valvesoftware.Steam
INFO:migration:Copying /home/reedclanton/.var/app/com.valvesoftware.Steam/config to /home/reedclanton/.var/app/com.valvesoftware.Steam/.config, ignoring set()
INFO:migration:Renaming /home/reedclanton/.var/app/com.valvesoftware.Steam/config to /home/reedclanton/.var/app/com.valvesoftware.Steam/config.old
INFO:migration:Symlinking /home/reedclanton/.var/app/com.valvesoftware.Steam/config to .config
INFO:migration:Copying /home/reedclanton/.var/app/com.valvesoftware.Steam/.local/share to /home/reedclanton/.var/app/com.valvesoftware.Steam/.local/share.bak, ignoring {'Steam'}
INFO:migration:Copying /home/reedclanton/.var/app/com.valvesoftware.Steam/data to /home/reedclanton/.var/app/com.valvesoftware.Steam/.local/share, ignoring {'Steam'}
INFO:migration:Renaming /home/reedclanton/.var/app/com.valvesoftware.Steam/data to /home/reedclanton/.var/app/com.valvesoftware.Steam/data.old
INFO:migration:Symlinking /home/reedclanton/.var/app/com.valvesoftware.Steam/data to .local/share
INFO:migration:Copying /home/reedclanton/.var/app/com.valvesoftware.Steam/cache to /home/reedclanton/.var/app/com.valvesoftware.Steam/.cache, ignoring set()
INFO:migration:Renaming /home/reedclanton/.var/app/com.valvesoftware.Steam/cache to /home/reedclanton/.var/app/com.valvesoftware.Steam/cache.old
INFO:migration:Symlinking /home/reedclanton/.var/app/com.valvesoftware.Steam/cache to .cache
INFO:root:Restarting app due to finalize sandbox tuning

error: While opening repository /var/lib/flatpak/repo: opening repo: opendir(/var/lib/flatpak/repo): No such file or directory
  1. Launch Steam again with the same command and verify that it now launches.
  2. Install the NixOS module of nix-flatpak along with a flatpak. For example, ASCii Draw (io.github.nokse22.asciidraw).
  3. Launch ASCii Draw and verify it works.
  4. Launch Arduino IDE 2 and verify that it now functions properly.

Note(s)

This issue occurs with other flatpaks, I've only chosen the above flatpak applications because they demonstrate the range of behaviors I seen when utilizing the Home Manager module of nix-flatpak.

Blocked By

@gmodena pointed out that this issue is a flatpak one. Thus this is blocked by https://github.com/flatpak/flatpak/issues/5488. Once that's resolved, this can be re-tested.

gmodena commented 9 months ago

Hey @ReedClanton,

Trying to replicate this bug. Are you using HomeManager standalone, or as a NixOs module?

ReedClanton commented 9 months ago

@gmodena as a NixOS module. Here's my config.

gmodena commented 9 months ago

I was able to reproduce.

To me is sounds very much similar to the issue reported in https://github.com/flatpak/flatpak/issues/5488 (that also mentions Steam).

gmodena commented 9 months ago

Under the hood the home-manager module will run flatpak with the --user switch.

I can repro the issue reported here by running the following on a clean install:

flatpak --user --noninteractive --no-auto-pin install  flathub cc.arduino.IDE2
ReedClanton commented 9 months ago

@gmodena Yup, that looks like the same issue...