Skip to content

Commit

Permalink
Revert "installer: forcefully delete remotes when managing state. (#86)…
Browse files Browse the repository at this point in the history
…" (#87)

This reverts commit 849a15b.
  • Loading branch information
gmodena authored Oct 20, 2024
1 parent 849a15b commit d9a4d20
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions modules/installer.nix
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,15 @@ let
'';
flatpakAddRemote = installation: remotes: map (flatpakAddRemotesCmd installation) remotes;

flatpakDeleteRemotesCmd = installation: uninstallUnmanagedState: {}: ''
flatpakDeleteRemotesCmd = installation: {}: ''
# Delete all remotes that are present in the old state but not the new one
# $OLD_STATE and $NEW_STATE are globals, declared in the output of pkgs.writeShellScript.
# If uninstallUnmanagedState is true, then the remotes will be deleted forcefully.
${pkgs.jq}/bin/jq -r -n \
--argjson old "$OLD_STATE" \
--argjson new "$NEW_STATE" \
'(($old.remotes // []) - ($new.remotes // []))[]' \
| while read -r REMOTE_NAME; do
${pkgs.flatpak}/bin/flatpak remote-delete ${if uninstallUnmanagedState then " --force " else " " } --${installation} $REMOTE_NAME
${pkgs.flatpak}/bin/flatpak remote-delete --${installation} $REMOTE_NAME
done
'';

Expand Down Expand Up @@ -216,7 +215,7 @@ pkgs.writeShellScript "flatpak-managed-install" ''
# Uninstall remotes that have been removed from services.flatpak.packages
# since the previous activation.
${flatpakDeleteRemotesCmd installation uninstallUnmanagedState {}}
${flatpakDeleteRemotesCmd installation {}}
# Install packages
${mkFlatpakInstallCmd installation updateApplications cfg.packages}
Expand Down

0 comments on commit d9a4d20

Please sign in to comment.