2024-10-11 23:27:07 +03:00
|
|
|
{ ... }:
|
|
|
|
{
|
|
|
|
text = ''
|
|
|
|
export _flatpakcfg_path="''${HOME}/.config/linux/Flatpak.txt"
|
2024-04-06 03:03:58 +03:00
|
|
|
|
2024-10-11 23:27:07 +03:00
|
|
|
# Prune everything unused in docker.
|
|
|
|
function prune_docker() {
|
|
|
|
docker system prune --volumes --all
|
|
|
|
}
|
2024-04-06 03:03:58 +03:00
|
|
|
|
2024-10-11 23:27:07 +03:00
|
|
|
# Prune Nix Store.
|
|
|
|
function prune_nix() {
|
|
|
|
nix-store --gc
|
|
|
|
}
|
2024-04-06 03:03:58 +03:00
|
|
|
|
2024-10-11 23:27:07 +03:00
|
|
|
# Uninstall flatpaks not listed in the config.
|
|
|
|
function prune_flatpak() {
|
|
|
|
local IFS=$'\n'
|
|
|
|
local config=($(cat ''${_flatpakcfg_path} | cut -f2))
|
|
|
|
local installed=($(flatpak list --app | cut -f2))
|
2024-04-06 03:03:58 +03:00
|
|
|
|
2024-10-11 23:27:07 +03:00
|
|
|
process() {
|
|
|
|
_contains ''${target} ''${config[@]} || flatpak uninstall ''${target}
|
|
|
|
}
|
2024-04-06 03:03:58 +03:00
|
|
|
|
2024-10-11 23:27:07 +03:00
|
|
|
_iterate_targets process ''${installed[@]}
|
|
|
|
}
|
|
|
|
'';
|
2024-04-06 03:03:58 +03:00
|
|
|
}
|