This repository has been archived on 2024-03-04. You can view files and clone it, but cannot push or open issues or pull requests.
linux/.config/bash/module/Prune.sh

26 lines
584 B
Bash

export _flatpakcfg_path="${HOME}/.config/linux/Flatpak.txt"
# Prune everything unused in docker.
function prune_docker() {
docker system prune --volumes --all
}
# Prune Nix Store.
function prune_nix() {
nix-collect-garbage -d
_is_root && nix-store --gc
}
# 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))
process() {
_contains ${target} ${config[@]} || flatpak uninstall ${target}
}
_iterate_targets process ${installed[@]}
}