OpenBSD + Nix is now a thing

I’m not really sure where you’re trying to go with that metaphorical language. But on any of the BSDs, Nix is certainly a ‘yolk’ in the sense or being almost unrecognizably far from its potential. Same for Nix on Windows and same for Guix on, say, macOS.

There’s not yet enough practical functionality (installable Nix packages) on those platforms for Nix to attract much of a userbase on those platforms. But with hardly any users, the only potential contributors are those who are interested in doing a lot of packaging work and don’t need many working packages today. That’s hardly anyone.

Contrast to Nixpkgs on Linux or Mac, where things are ‘good enough’ to attract lots of users who mostly want to just use Nix but may also make drive-by contributions at the margin. Nixpkgs on those platforms is already over some initial hurdles that it just isn’t on other platforms.

And it does seem to be a bootstrapping/critical mass issue to me; it would be easier to find contributors to a more mature version of any of those Nixpkgs platforms than what is currently in Nixpkgs. That’s why, imo, milestones like the one in the OP can be so exciting: it raises Nix’s visibility in those small communities and also shows some momentum, increasing the hope that Nixpkgs might reach critical mass on those platforms.

1 Like

I just wish Nix won’t become a wall like Docker on the BSDs, with upstream project installation instructions being “just use docker” or “just run nix build”.

3 Likes

I see, I made some corrections.

Things like this can be fixed…

First they ignore you, then the laugh at you, then they fight you and then and only then you win.

I’m not sure which stage nix is at, but it’s certainly fun.

I hope you lot are laughing with me, and not at me.

Else i’ll have to go back into making a living music… and i wouldn’t want anyones eardrums to endure that ;-).

Interesting Insights, I wonder what @Atemu thinks.

1 Like

Code can be found eg https://github.com/freebsd/freebsd-ports/tree/main/sysutils/nix or FreshPorts -- sysutils/nix: Purely functional package manager

1 Like

Except an incredible amount of probably underappreciated and hard to upstream work.

6 Likes

Does bsd not support sandboxing? https://github.com/freebsd/freebsd-ports/blob/37ac9087157fa62e9b5e843be6f742da5e4a68c4/sysutils/nix/Makefile#L45

You linked to FreeBSD ports tree, which is a different operating system

seccomp is Linux specific.

OpenBSD has pledge + unveil , see man.openbsd.org/pledge and unveil(2) - OpenBSD manual pages

FreeBSD has capsicum Capsicum - FreeBSD Wiki

No idea for NetBSD and DragonFly BSD (which are the two other main BSD and other different operating systems), nor if they have a working Nix

1 Like

This starts by having a BSD friendly upstream, which is quite rare nowadays :cry:

ah thanks, mixed the bsd’s up.

so at least https://github.com/openbsd/ports/blob/f8083bbcde77f23eb0ab33d2fa3d6fa9ac96daf2/sysutils/nix/patches/patch-src_nix-daemon_nix-daemon_cc should be upstreamed. I am looking into boost_context-mt in the next days. I don’t think the other patches should be upstreamed as is.

2 Likes

I would like to see some NixOS/k*BSD built around GitHub - InitWare/InitWare: The InitWare Suite of Middleware allows you to manage services and system resources as logical entities called units. Its main component is a service management ("init") system.. I have some plans on baby steps to get us closer to that.

The best thing folks can do right now is help with cross compilations to new platforms (purer and easier to keep working in CI today than native stuff! And the best way to help with that is poke ones head in https://matrix.to/#/#exotic:nixos.org.

5 Likes

I suspect this is naive since I avoid the module system as much as I can and my knowledge is a little superficial+user-oriented, but whenever I’m doing something like setting up a development shell for a database or web server that has a module, I end up wondering if it would make sense to ~pull more config-generation logic towards the packages in the form of passthru functions and slim down the existing module implementations in nixos/nix-darwin/home-manager (and maybe devenv or others?)

I guess it might make the external module systems too sensitive to the nixpkgs rev, but I could also imagine it making it easier to:

  • deduplicate work
  • get more people invested in refining the config abstractions
  • create more leverage for setting up dev environments
  • make it easier to iterate on the groundwork needed for good BSD/etc. modules by exercising them in dev environments
  • minimize the module work needed to jump from there to the first palatable BSD-based NixOS (and maybe also each Nth? not knowledgeable enough about BSDs to know how much overlap there’d be at this level)
3 Likes

Yeah we should try to share stuff between NixOS and the other module system things. I have yet to fully dive into that so I don’t have many specific suggestions, but Initware in being a systemd fork is supposed to help avoid / shrink down that problem by allowing us to use the same unit files.

4 Likes

Awesome news. I can’t wait for FreeBSD support !

1 Like

Nix is already packaged for FreeBSD: https://cgit.freebsd.org/ports/tree/sysutils/nix

2 Likes

It feels like NixOS modules are generally quite tied to systemd, so I’m not sure how it would work on other OSes than GNU/Linux/systemd…

I believe this was discussed by @7c6f434c and @sander a few years ago at NixCon IIRC. I don’t believe anything came of it, though. It is a good idea.

1 Like

Parts of a module take care of generating config files for a service. These parts could be moved closer to the package itself.

2 Likes

Yeah, because what I truly want are functions and direct overrides, and a) people want type checking b) we don’t have a systematic type checking solution except the module system that I avoid as far as possible, there is a way to at least suppress the worst things about the module system, but I haven’t figured out a complete integration solution for that. (I haven’t got around to spend much time on it, either; if someone is already good at using the module system and makes a PoC PR, I will happily update the RFC to document the proposed solution in the currently-missing part, and get the things moving again)

2 Likes

We can also cross compile OpenBSD binaries now!

Nixpkgs branch: GitHub - obsidiansystems/nixpkgs at openbsd-rollup (will be making PRs from here and force pushing it, be warned)

Command:

nix-build --arg crossSystem '{ system = "x86_64-openbsd"; isStatic = true; }' -A hello

Chat room: #nix-openbsd:tapenet.org which already existed, thanks to @qbit who previous took a stab at at this, and more recently answered many questions. Let’s revive it!

21 Likes