pipac
(Prune and Install PACkages) is a Python tool that helps maintain a clean system (Arch Linux or similar) by ensuring that explicitly installed packages match user-provided package lists (declarative package management).
- maintains system packages based on package lists
- supports multiple package managers (yay, paru, pacman)
- handles optional dependencies
git clone https://github.com/j4kub5/pipac
cd pipac
sudo install -Dm755 pipac.py /usr/bin/pipac
yay -S pipac
pipac [COMMAND]... [PACKAGE_LIST]...
-h
,--help
- display help message
-i
,--install
- install packages from lists that are not currently installed
-p
,--prune
- prune packages not in lists (mark as dependencies)
-n
,--new
- print installed explicit packages missing from the lists
Package lists are text files; packages are line or space separated. Optional dependencies should be prefixed with &
. Everything in a line after #
is a comment (ignored by the program).
Example package list:
package1 package2 # comment &optional_dependency_for_package2 # comment package3 package4 package5 &optional_dependency_for_package5
pacman -Qeq > packages.txt
If no package lists are specified as arguments pipac
will use default package lists:
~/.config/pipac/packages.txt
~/.config/pipac/$HOSTNAME.txt
Replace $HOSTNAME
with the actual name:
cat /proc/sys/kernel/hostname
After you manually edit the package list(s) you may:
# Install missing packages in default lists
pipac -i
# Prune packages not in default lists
pipac -p
yay -Yc # or paru -c or sudo pacman -Rns $(pacman -Qtdq)
# Install missing packages in lists
pipac -i packages.txt $HOSTNAME.txt
# Prune packages not in lists
pipac -p packages.txt $HOSTNAME.txt
yay -Yc # or paru -c or sudo pacman -Rns $(pacman -Qtdq)
# Combine prune and install
pipac -ip packages.txt $HOSTNAME.txt
# Add packages you installed manually to a list
pipac -n >> ~/.config/pipac/packages.txt
pipac -p packages.txt $HOSTNAME.txt
yay -Yc # or paru -c or sudo pacman -Rns $(pacman -Qtdq)
pipac -i packages.txt $HOSTNAME.txt
- [ ] feature: flatpaks
- [ ] documentation: document alternative software
- [ ] documentation: explain ¿why?
- [ ] feature: genrerate packages.txt in config directory
- [ ] feature: diff or dry run
- [X] feature: print out a list of newly installed packages (not yes added to lists)
- [X] add license
- [X] make $HOSTNAME.txt in config directory optional
- [X] more examples (use with scripts)
- [X] create an AUR package
- [X] feature: update system while installing
- [X] feature: read default package lists
- [X] feature: default behavior when no arguments are passed