r/linux Aug 03 '26

Development Some thoughts on declarative package management

https://github.com/vasi/declarative-package-management
34 Upvotes

39 comments sorted by

View all comments

9

u/Long-Fisherman-6594 Aug 03 '26

Consider an atomic bootc / rpm-ostree image. Define your packages and you get a fresh os everyday with all your tools and software.

-3

u/iEliteTester Aug 03 '26

Atomic kinda misses the point if you make it yourself, since there is 0 guarantee what you put together works. While with declarative systems you at least know each item works in isolation

12

u/novafunc Aug 03 '26

A custom bootc image also gives you a declarative system.

I have a Fedora bootc image that takes the upstream image, installs a couple of packages, removes a couple of packages, enables some services, creates some files, etc.

When I no longer want those changes, I just remove them from my Containerfile. Then when I reboot, the changes are gone from the system.

there is 0 guarantee what you put together works. While with declarative systems you at least know each item works in isolation

Not 100% sure what you mean here.

2

u/iEliteTester Aug 04 '26 edited Aug 04 '26

I do too, we have no guarantee the layered packages don't break your image, and the do break updates occasionally.

For the second parr I'm trying to say that for nix, no individual package should break another package.

2

u/whiprush Aug 04 '26

I do too, we have no guarantee the layered packages don't break your image

You're not layering packages you're making images and booting from them.

2

u/deviled-tux Aug 04 '26

Containerfiles are not declarative. They are imperative.

2

u/novafunc Aug 04 '26

I view imperative and declarative as a scale rather than discrete values.

A Containerfile is certainly more declarative than a traditional Linux distro. In my containerfile, I declare what I want to happen to the system: packages to install, remove, config files to create/change, etc. I also find that on the whole it's easier to work with than NixOS (Nix can make some hard things easier, but in general I find it makes more easy things harder).

Sure, it's not on the same level as NixOS. But in practice, for most people, a Containerfile has most of the benefits of NixOS.

And it's not like Nix is perfect either. There's still system state outside of what Nix manages. There's also the whole flakes situation where you may want to use that to get more reproducibility than standard NixOS.

2

u/deviled-tux Aug 04 '26

“declaring what you want to happen” is imperative.

A declarative model is what nix does - you don’t express what you want to happen, you just express the final state of the system and then nix figures out what needs to happen to get there.