Home

Packaging your setup on Debian

Written on 2020-10-25

Keeping track of your configuration and deploying it on new machines is quite easily done with Git and maybe a fancy system like GNU Stow. However, installing all of the software that you use can be annoying, especially if you realize after a few days that a part of your setup is slightly broken because you forgot to install a package.

The obvious solution to that problem is to use a declarative package manager like Nix. However, systems built around those are quite complex and many users might not want to switch to using them.

Instead, Debian (and Ubuntu/other derivatives) users can simply build themselves a .deb metapackage, that is a package that installs nothing on its own but depends on other packages. A simple metapackage is trivial to build and is a convenient way to install many packages at once.

To do so, create a file mysetup/DEBIAN/control looking something like this:

Package: mysetup
Version: 1.0
Section: custom
Priority: optional
Architecture: all
Depends: bspwm, firefox-esr, neovim
Essential: no
Maintainer: Me!
Description: Metapackage with everything I care about

Use dpkg-deb --build mysetup and you will have build a mysetup.deb package. That's it! You can now ship it to any host, use apt install ./mysetup.deb and all of the packages under Depends will be installed.

Additional steps might include packaging in setup scripts that are run after installation, e.g. to fetch your configuration from the internet and symlink it.