GermanBread / declarative-flatpak

126 stars 4 forks source link

manage flatpak remotes w/ `services.flatpak.remotes` #1

Closed TH3-S4LM0N closed 1 year ago

TH3-S4LM0N commented 1 year ago

Nothing exploded on my system so it's probably fine

GermanBread commented 1 year ago

Looks great! However it should also remove remotes NOT declared in the config

TH3-S4LM0N commented 1 year ago

However it should also remove remotes NOT declared in the config

How do you suggest to do that?

for i in "$(flatpak remotes --columns=name)"; do
   flatpak remote-delete $i
done

would delete all remotes and re-add them which seems inefficient

GermanBread commented 1 year ago

You can try diffing the remotes declared in the config vs what flatpak remotes --columns=name,url returns.

Take a look at how the module does diffing in the "uninstall" part


My brain also considered the possibility of declaring remotes like this (would factor out formatting inconsistencies between the flatpak cli and malformed strings in the user's nixos config)

services.flatpak.remotes = [
  {
    name = "foo";
    url = "https://example.com/foo.flatpakref";
  };
];

You'd then have to reconstruct the string somehow

GermanBread commented 1 year ago

Hi, just to let you know, I'm still interested in getting this merged.

Edit: I could merge this PR as-is, but I would have to resolve the review above myself.

GermanBread commented 1 year ago

I implemented this feature myself