You are not logged in.

#1 2018-01-12 04:04:49

rendaw
Member
Registered: 2016-02-17
Posts: 6

decpac - Simple declarative package management

Basically I wanted to keep a list of packages and synchronize my system to that list.  I've tried NixOS on one computer, but I'm not 100% on board yet and mixing package managers scares me a bit.  I wanted something maybe a bit simpler to get used to the idea, so I made decpac!

The config looks like:

{
...
       installed: [
...
               * audio *                                                                                                                                                                           
                alsa-utils,                                                                                                                                                                         
                alsaequal,                                                                                                                                                                          
                alsaequal-mgr,                                                                                                                                                                      
                alsaplayer,                                                                                                                                                                         
                                                                                                                                                                                                    
                * games *                                                                                                                                                                           
                antimicro,                                                                                                                                                                          
                desmume,                                                                                                                                                                            
                xboxdrv,                                                                                                                                                                            
                steam,                                                                                                                                                                              
                steam-native-runtime,                                                                                                                                                               
                                                                                                                                                                                                    
                * dev *                                                                                                                                                                             
                apache-ant,                                                                                                                                                                         
                zenity, * enc password entry *
...
        ],
},

And you synchronize with:

$ decpac
Scanning current package state...
Installing ['gvfs']
Removing []
Okay? [y/N] y
[sudo] password for rendaw: 
...
No packages to remove.
Done

More explanation and installation here:

https://github.com/rendaw/decpac

Very heavily untested.  I've installed, removed, and generated an initial config file with it without bricking my system, but take some care if you try it out.

Last edited by rendaw (2018-01-12 04:09:02)

Offline

#2 2018-01-12 04:13:30

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 20,142
Website

Re: decpac - Simple declarative package management

If you really just want to have your currently installed packages set to match /etc/decpac.conf, wouldn't this acheive that:

pacman -R $(comm -23 <(pacman -Qq) <(sort /etc/decpac.conf))
pacman -S $(</etc/decpac.conf)

"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2018-01-12 09:20:53

rendaw
Member
Registered: 2016-02-17
Posts: 6

Re: decpac - Simple declarative package management

Thanks taking a look!

Yeah, it ended up being simpler than I initially thought, but the code is also pretty simple.

decpac has more functionality, like filtering comments, confirming changes with the user, generating an initial decpac.conf, configuring the install command (and remembering it) and various paths.  It's around 100 lines (Python).

I'm also not sure it's feature complete and decpac has a clean design that should make future changes easy enough, which I also think is worth something.  If other people find it useful it may be necessary to expose more pacman options in the configuration or perhaps build in compatibility with aur helpers, for example.

Last edited by rendaw (2018-01-12 09:37:33)

Offline

#4 2018-04-16 15:16:22

CyberShadow
Member
Registered: 2016-03-03
Posts: 5
Website

Re: decpac - Simple declarative package management

Good stuff. If anyone is interested in managing not just the package list, but also configuration files (and the system configuration in general), you may like aconfmgr:

https://github.com/CyberShadow/aconfmgr

Offline

#5 2018-04-16 15:24:04

rendaw
Member
Registered: 2016-02-17
Posts: 6

Re: decpac - Simple declarative package management

Oh hey, that does look really good.

I'll have to take some time to read through that.  I wonder how complex it is?  Package management is unified via pacman but config on Arch is all over the place.

aconfmgr is probably what I want in the long term though.

Offline

Board footer

Powered by FluxBB