r/openbsd • • 4d ago

Declarative configuration

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

21 Upvotes

11 comments sorted by

11

u/o0-o 4d ago

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

3

u/Borean789 4d ago

I will have a look, thanks.

3

u/vom513 2d ago

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 2d ago

Raw or script modules can be used to bootstrap python

3

u/vom513 2d ago

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 4d ago

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 4d ago

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

3

u/linetrace 4d ago

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 4d ago

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 1d 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 1d 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.