Prune : Add Flatpak prune.
This commit is contained in:
parent
25d2eb9cb5
commit
e71067521c
|
@ -20,11 +20,6 @@ function docker_update() {
|
||||||
docker images --format "{{.Repository}}:{{.Tag}}" | xargs -L1 docker pull
|
docker images --format "{{.Repository}}:{{.Tag}}" | xargs -L1 docker pull
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prune everything.
|
|
||||||
function docker_prune() {
|
|
||||||
docker system prune --volumes --all
|
|
||||||
}
|
|
||||||
|
|
||||||
# Docker compose shortcut.
|
# Docker compose shortcut.
|
||||||
function dc() {
|
function dc() {
|
||||||
docker compose "${@}"
|
docker compose "${@}"
|
||||||
|
|
|
@ -26,12 +26,6 @@ function nix_update() {
|
||||||
nix flake update "${_nix_system_config}"
|
nix flake update "${_nix_system_config}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Free up root space.
|
|
||||||
function nix_prune() {
|
|
||||||
nix-collect-garbage -d
|
|
||||||
_is_root && nix-store --gc
|
|
||||||
}
|
|
||||||
|
|
||||||
# Spawn shell with specified nix environment.
|
# Spawn shell with specified nix environment.
|
||||||
# Uses flake.nix in current dir by default.
|
# Uses flake.nix in current dir by default.
|
||||||
# Usage: nix_shell [NAME]
|
# Usage: nix_shell [NAME]
|
||||||
|
|
25
.config/bash/module/Prune.sh
Normal file
25
.config/bash/module/Prune.sh
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
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[@]}
|
||||||
|
}
|
10
.doc/Bash.md
10
.doc/Bash.md
|
@ -132,7 +132,6 @@ Command|Description
|
||||||
`docker_health`| Check if any container exited.
|
`docker_health`| Check if any container exited.
|
||||||
`docker_ip <CONTAINER>`|Find out container's IP address.
|
`docker_ip <CONTAINER>`|Find out container's IP address.
|
||||||
`docker_update`| Update all docker images.
|
`docker_update`| Update all docker images.
|
||||||
`docker_prune`| Prune everything.
|
|
||||||
`dc`| Docker compose shortcut.
|
`dc`| Docker compose shortcut.
|
||||||
`dcu [SERVICES]`|Docker compose up.
|
`dcu [SERVICES]`|Docker compose up.
|
||||||
`dcd [SERVICES]`|Docker compose down.
|
`dcd [SERVICES]`|Docker compose down.
|
||||||
|
@ -270,7 +269,6 @@ Command|Description
|
||||||
`nix_rebuild [HOSTNAME]`|Rebuild system. Optionally force the hostname.
|
`nix_rebuild [HOSTNAME]`|Rebuild system. Optionally force the hostname.
|
||||||
`nix_switch [HOSTNAME]`|Rebuild and switch system. Optionally force the hostname.
|
`nix_switch [HOSTNAME]`|Rebuild and switch system. Optionally force the hostname.
|
||||||
`nix_update`|Update system versions.
|
`nix_update`|Update system versions.
|
||||||
`nix_prune`| Free up root space.
|
|
||||||
`nix_shell [NAME]`|Spawn shell with specified nix environment. Uses flake.nix in current dir by default.
|
`nix_shell [NAME]`|Spawn shell with specified nix environment. Uses flake.nix in current dir by default.
|
||||||
`nix_tmpshell <PACKAGES>`|Spawn nix-shell with specified packages.
|
`nix_tmpshell <PACKAGES>`|Spawn nix-shell with specified packages.
|
||||||
`nix_live`| Build live image.
|
`nix_live`| Build live image.
|
||||||
|
@ -321,6 +319,14 @@ Command|Description
|
||||||
`perm_share`| Recursively change permissions to allow read sharing with group and others.
|
`perm_share`| Recursively change permissions to allow read sharing with group and others.
|
||||||
`perm`| Recursively change permissions to restrict access for group and others.
|
`perm`| Recursively change permissions to restrict access for group and others.
|
||||||
|
|
||||||
|
## Prune.
|
||||||
|
|
||||||
|
Command|Description
|
||||||
|
---|---
|
||||||
|
`prune_docker`| Prune everything unused in docker.
|
||||||
|
`prune_nix`| Prune Nix Store.
|
||||||
|
`prune_flatpak`| Uninstall flatpaks not listed in the config.
|
||||||
|
|
||||||
## Ps.
|
## Ps.
|
||||||
|
|
||||||
Command|Description
|
Command|Description
|
||||||
|
|
Reference in a new issue