Simple declarative package management for Arch Linux.
Declarative package management means essentially having a fixed list of packages declared in a file used for installation. When running the package manager, all packages in the list are installed and all installed packages not in the list are removed. This allows you to keep better track of which packages are installed and why, since you can reorganize the file any way you prefer and also add comments to it.
This is heavily inspired by decpac, but I wanted a more lightweight syntax on the package list file.
Check that you have the dependencies installed (otherwise
pcmn will fail):
Install the package from AUR: pcmn-git.
pcmn for the first time, start by generating a package list:
This will create a package list in
~/.config/pcmn/pkglist. If you want to save it to a different file, use
Now, use the
apply command anytime you want to apply the packages defined on the package list. This will install packages listed there but not already installed and remove the packages that are installed but aren't on the list:
Feel free to reorganize the packages order on the list, add comments, spacing, etc. That's the point of using
pcmn after all!
Package list format
The formatting is very simple:
- One package per line
- Everything after a
#is a comment
- A package can optionally be prefixed with a
[GROUP]to assign it to the
GROUPgroup, otherwise it will be assigned to the default group
- Not every line needs to have a package (it can be empty, or have a comment)
# #This is my package list # firefox # Need firefox to surf the web [aur] magic-wormhole # I use this to transfer files. Needs to be installed from AUR grub
A group can be used to define other commands to install, query and remove the packages. Assigning a package to a group then makes it use the commands of its group to be installed, query and removed.
The default group is
pacman which uses pacman to query, install and remove the native packages.
The other possible group is
aur, which is used for non-native packages, that should be installed through AUR. The
yay AUR-helper is used for this.
Config file (changing commands)
A configuration file can be used to change which commands are used to query, install and remove packages from a specific group. It uses the JSON format and by default is searched on
~/.config/pcmn/config.json. A sample JSON config is in this repository as
config.json, and if you installed from the AUR, can also be found at
/usr/share/pcmn/config.json on your system.
Each command should be written as a list of strings. For
remove_cmd, if multiple commands are needed, a list of lists can be used (just like in the sample config for
query_cmd should return a list with only the package names installed for that group and with each package in a separate line. Both
remove_cmd are called with the packages to be installed/removed after the last parameter.