nix/home/program/bash/module/Prune.nix

30 lines
677 B
Nix
Raw Normal View History

{ ... }:
{
text = ''
export _flatpakcfg_path="''${HOME}/.config/linux/Flatpak.txt"
2024-04-06 03:03:58 +03:00
# Prune everything unused in docker.
function prune_docker() {
docker system prune --volumes --all
}
2024-04-06 03:03:58 +03:00
# Prune Nix Store.
function prune_nix() {
nix-store --gc
}
2024-04-06 03:03:58 +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
process() {
_contains ''${target} ''${config[@]} || flatpak uninstall ''${target}
}
2024-04-06 03:03:58 +03:00
_iterate_targets process ''${installed[@]}
}
'';
2024-04-06 03:03:58 +03:00
}