r/openbsd • • Nov 03 '26

Declarative configuration

I am wondering if there are projects for a declarative configuration with Openbsd (nix like)?

22 Upvotes

12 comments sorted by

11

u/o0-o Nov 03 '26

Ansible is the best option I know of but you’re mostly stuck with basic command, template, file, slurp, etc modules.

3

u/Borean789 Nov 03 '26

I will have a look, thanks.

3

u/vom513 Nov 05 '26

I did ansible on netbsd with success. The one thing is the chicken and egg of not having python initially. So youll need that binary package available and then you can have ansible install it on a vanilla machine as a “bootstrap” playbook. Im far from an ansible expert and there’s likely other ways to handle this but it worked for me.

2

u/o0-o Nov 05 '26

Raw or script modules can be used to bootstrap python

3

u/vom513 Nov 05 '26

Yep I think thats what I did. For my vintage machines I had to (slowly) build python myself. So whatever folks do in their workflow to get packages installed (binary, build from source) is what your bootstrap needs to pull and then you can be off to the races with ansible proper.

5

u/toyg Nov 03 '26

Not very nix-like I think, but somewhat declarative, is what I'm working on at the moment: https://www.reddit.com/r/openbsd/s/9BzYc29vPJ

It's not really ready for prime time (the "dev" side works ok, but "prod" mode is still up in the air).

3

u/djhankb Nov 03 '26

I have had a lot of luck with Salt Project/Saltstack on OpenBSD over the years.

3

u/linetrace Nov 04 '26

Solène put together a utility called pkgset a number of years ago and wrote about it on her blog:

Managing OpenBSD installed packages declaratively

I've not tried it, but I still use her tangentially-related drist utility for configuration management on a number of devices running OpenBSD, macOS, other Linux/BSDs.

2

u/Original_Two9716 Nov 04 '26

I started doing exactly this yesterday myself, via symlinks. Switching between external lowdpi, and internal hdpi displays on my Thinkpad, so tweaking .Xresources, .emacs.d etc etc.

1

u/brejoc 29d ago

There is also pyinfra, which I think is a bit more appealing than Ansible or Salt. But I don’t know how well OpenBSD is supported.

1

u/zetsurin 29d ago

Maybe chezmoi (https://github.com/twpayne/chezmoi)? I plan on moving my Nix configs to chezmoi as nix isn't ready for BSD really. As a bonus they ban LLM code submissions so it's a human written project.

1

u/Izder456 27d ago

Its not as declarative as nix, but this framework is pretty easy to pick up, and even extend in cases where you need more functionality: https://www.rexify.org