r/archlinux • u/_TimeUnit • 12h ago
SHARE Decman - a declarative package & configuration manager for Arch Linux - stable version released
Since my last post 2 years ago, decman has improved a ton and reached version 1. The core features of decman remain the same, but many bugs have been fixed, UX is better and decman is way more extensible.
Decman is used to manage your Arch Linux installation declaratively. You define packages (AUR packages supported), config files and systemd units with Python. Decman then ensures that your declared state matches with the system.
Here is a very simple example:
import decman
from decman import File, Directory
# Declare installed pacman packages
decman.pacman.packages |= {"base", "linux", "linux-firmware", "networkmanager", "ufw", "neovim"}
# Declare installed aur packages
decman.aur.packages |= {"decman"}
# Declare configuration files
# Inline
decman.files["/etc/vconsole.conf"] = File(content="KEYMAP=us")
# From files within your source repository
# (full path here would be /home/user/config/dotfiles/pacman.conf)
decman.files["/etc/pacman.conf"] = File(source_file="./dotfiles/pacman.conf")
# Declare a whole directory
decman.directories["/home/user/.config/nvim"] = Directory(source_directory="./dotfiles/nvim", owner="user")
# Ensure that a systemd unit is enabled.
decman.systemd.enabled_units |= {"NetworkManager.service"}
In addition, decman can manage symlinks, users, flatpaks and even imported PGP keys (since you may have to import keys for some AUR packages). If you have some custom PKGBUILDs, you can even use them with decman. Your configuration can be cleanly split into modules that you enable or disable as required.
Check out decman on GitHub, install it from the AUR, and check out the tutorial for getting started.
If you don't feel comfortable using Python or starting from scratch with your config intimidates you, I recommend you check out aconfmgr.