GermanBread / declarative-flatpak

126 stars 4 forks source link

stable-v3 breaks xdg-open usage #29

Open onemoresuza opened 1 month ago

onemoresuza commented 1 month ago

Description

After updating my config to the stable-v3 branch, using xdg-open on links or files that use an installed flatpak does not work anymore.

The following error is thrown every time --- the following example is using Libreoffice to open a file on the ~/Downloads folder:

[user@hostname: ~/Downloads] $ xdg-open file.csv
error: While opening repository /home/<user>/Downloads/"/home/<user>/.local/share/flatpak"/repo: opening repo: opend
ir(/home/<user>/Downloads/"/home/<user>/.local/share/flatpak"/repo): No such file or directory

The error does not happen when using the stable branch.

The error is not triggered when using the flatpak binary directly (in this case, org.libreoffice.LibreOffice).

Here's the bash code for xdg-open when it's calling the flatpak:

/nix/store/<hash>-9.5/bin/env env 'FLATPAK_USER_DIR="/home/<user>/.local/share/flat
pak"' 'FLATPAK_SYSTEM_DIR="/home/<user>/.local/share/flatpak"' flatpak run --branch=stable --arch=<arch> --command=libreo
ffice --file-forwarding org.libreoffice.LibreOffice --calc @@u file.csv @@

Removing the FLATPAK_*_DIR variables from the call removes the error. So I think there's something going wrong with scr/script.nix when downloading/setting up the flatpaks.

GermanBread commented 1 month ago

Hmm I'm not sure what causes this to happen.

I decided to push a workaround to the dev branch... see if that does anything

Cheers

onemoresuza commented 1 month ago

Thanks for the quick response.

I've tried the dev branch, however, its evaluation fails with the following message:

error: attribute 'fpkg' missing

at /nix/store/<hash>-source/src/options.nix:5:4:

     4|
     5| let
      |    ^
     6|   flatpak-types = callPackage ./lib/types/flatpak.nix {};

I think it is because fpkg and fremote are being inherited from ./src/lib/types/flatpak.nix, while they're defined and exposed by ./src/lib/types/regexes.nix.

GermanBread commented 1 month ago

Oops. Try again.

onemoresuza commented 1 month ago

Tested both Steam and Libreoffice with the new commit and xdg-open is working.

GermanBread commented 1 month ago

I'll just go ahead and merge my changes into the stable-v3 branch...

I'm very puzzled, because the relevant code didn't change at all (besides the paths) between stable-v2 and stable-v3...