Live data from Hacker News

Show HN: Brioche – A new Nix-like package manager

brioche.dev

11–20 of 90 posts

Re: Show HN: Brioche – A new Nix-like package manager

#11
I'm also exploring a post-Nix package manager, wip: https://github.com/porkg/porkg

My mantra has been to avoid "getting bored" and inventing DSLs for the longest time. I initially sought to use Nickel-lang, but it was missing some features that would make it an ideal candidate for this. I started writing my own (you may find this in the history) before realizing "WTF are you doing writing another shitty DSL?" I have subsequently decided that shell scripts (or anything you can shebang) are good enough, i.e. pkgbuild inspiration.

I also plan to avoid making a derivation the source of reproducibility. Instead, a lockfile will offer that. This should alleviate the issue whereby updating the like of glibc cascades into an entire rebuild.

Any *OS and home-manager would need to bring in a configuration language. I think Cue really makes the most sense, but that's still a long way off.

Nice to see you used JS instead of yet another DSL :)

Re: Show HN: Brioche – A new Nix-like package manager

#12

Beat me to it! It's my dream to write a Nix replacement in a more approachable language. I can't state enough how the choice of a bespoke DSL that doesn't immediately make sense to most developers keeps Nix/Nixos community from growing. And Nix is 18 years old now, it's long overdue for a rewrite[1]. Don't implement channels to start with. Focus on full reproducibility. (...getting into sci-fi territory...) Build in…

I think Flakes kind of help with the centralized problems. At least individual flakes can be run or installed separately, they don't have to be merged into the core nixpkgs repo, and they (at least in theory) should be giving the same build reproducibility as you'd get from installing directly from nixpkgs.

I agree with the torrent idea though.

Re: Show HN: Brioche – A new Nix-like package manager

#13
post #11

I'm also exploring a post-Nix package manager, wip: https://github.com/porkg/porkg My mantra has been to avoid "getting bored" and inventing DSLs for the longest time. I initially sought to use Nickel-lang, but it was missing some features that would make it an ideal candidate for this. I started writing my own (you may find this in the history) before realizing "WTF are you doing writing another shitty DSL?" I have…

I suggest the post author and you look into nu as the package build language. It's uniquely suited for this task, being a cross-platform shell[1] with real programming language features, data types, and using built-in uutils instead of relying on platform-dependent coreutils. It also limits mutability[2], favoring a more functional than imperative approach, which would at least theoretically help with reproducibility. A guy from Determinate Systems recently made an experiment on integrating nushell to nix and the results were positive. Take a look: https://determinate.systems/posts/nuenv/

1: https://www.nushell.sh/

2: https://www.nushell.sh/book/thinking_in_nu.html#variables-ar...

Re: Show HN: Brioche – A new Nix-like package manager

#14
post #7

I'm very excited by all the attempts to replace Nix, but I don't think I'll be exploring this much deeper. In my opinion the issue with Nix is that the data model is not crisply defined -- it's there, but hidden under a lot of goop that is the Nix language itself and the various assumptions and baggage that goes with it. What I want is a primarily declarative syntax supporting a rich set of data structures, ideally a…

Agreed on all counts, especially the central issue with nix and the properties that I'd want out of a replacement. I think CUE ( https://cuelang.org/ ) is a perfect language for this.

Re: Show HN: Brioche – A new Nix-like package manager

#15
Some of the oddities of the nix language are pretty useful for its domain. Recursive attribute sets, for instance, save a lot of headaches if you're trying to have only a single source of truth. Do you feel like these translate to typescript nicely?

As somebody who knows nix but doesn't know typescript, I found myself looking for a rosetta stone page where I could look at two chunks of code that do the same thing, but in separate languages. This would let me use the familiar language to scrutinize the other.

I wouldn't normally ask for such a thing, but if you're putting "Nix-like" in the title then maybe it might be worth adding a comparison page to the docs.

Re: Show HN: Brioche – A new Nix-like package manager

#16
post #7

I'm very excited by all the attempts to replace Nix, but I don't think I'll be exploring this much deeper. In my opinion the issue with Nix is that the data model is not crisply defined -- it's there, but hidden under a lot of goop that is the Nix language itself and the various assumptions and baggage that goes with it. What I want is a primarily declarative syntax supporting a rich set of data structures, ideally a…

Starlark is widely used by Bazel and Buck. That would fulfill similar properties and build system folks have one fewer thing to learn.

Re: Show HN: Brioche – A new Nix-like package manager

#17
I am not writing typescript -- heaven forbid -- so I can manage cargo, so I can write Rust.

Dropping the snark, though -- most times I have seen folks attempt to fold other build systems into some polyglot common one, it seems to create a lot of problems -- for at the end of the day, build tools (whether npm, cargo, gradle, docker, etc.) each have their issues. When these issues arise, they require understanding the original build tool. Bazel, for example, is a "polyglot" system which many try to use to manage npm. In my experience, when folks use bazel but have never used npm directly, they often get lost, because they now have to deal with two abstractions (bazel, npm) simultaneously neither have a way for bazel to do the thing they need, nor an understanding of how to get bazel to do that thing (nor npm itself to do the thing), also because they have never worked with npm directly.

Same goes for cargo, incidentally. Switching over to that build tool -- like any major build tool, it has an insane amount of well-honed documentation and thousands of answered questions online (not to mention LLMs trained somewhat well on it). Users when they need to do something with brioche or have an issue with it will not necessarily have the benefit of the massive collaborative support available for cargo.

Incidentally, I don't think that nix is free of this problem, though it does attempt to manage these issues -- sometimes reasonably successfully -- by virtue of keeping interfaces to other build tools in simple, direct ways.

Even then, however, the best way I have seen nix used is as a system for declaring all binary dependencies or other dependencies that are either not manageable or especially competently managed by other build tools -- which nix allows for in a virtual environment by shipping a shell.nix or flake.

In other words -- bringing in the right version of java, gradle, node, etc. But then just directing users to the specific, native build tools that often have a massive number of contributors.

The closest thing to a tool that does this (guides developers to other build tools) is flox, which uses TOML, but uses nix for its backend via C API. I haven't had a chance to use it much yet, but it looks very promising https://flox.dev.

===

Okay, all this rambling aside -- building a tool like this for yourself or a small team, especially when you have the time to do it, it works well, and you're having fun... well, there's an insane amount to be said for that; and it will doubtlessly lead you to learning a ton about other build tools and likely offer you deep insights that are only possible when attempting to build something like brioche. So, on that count, major kudos to you.

Re: Show HN: Brioche – A new Nix-like package manager

#18
post #7

I'm very excited by all the attempts to replace Nix, but I don't think I'll be exploring this much deeper. In my opinion the issue with Nix is that the data model is not crisply defined -- it's there, but hidden under a lot of goop that is the Nix language itself and the various assumptions and baggage that goes with it. What I want is a primarily declarative syntax supporting a rich set of data structures, ideally a…

Agreed on all counts, especially the central issue with nix and the properties that I'd want out of a replacement. I think CUE ( https://cuelang.org/ ) is a perfect language for this.

Cue is fun, but already the unification example (https://cuelang.org/docs/tour/basics/duplicate-fields/) shouts "footguns" to me :(

TS is certainly excessively powerful though.

Re: Show HN: Brioche – A new Nix-like package manager

#19
post #2

Flakes definitely help with the giant megarepo annoyances of NixOS, though they're still a little irritating. If you are writing in a languages that doesn't hasn't had its packages directly integrated into the build system (like Python's has), it can be really irritating to do anything with them, since the `nix build` command disables network access and you therefore cannot use regular package manager. I'm doing a pr…

>`nix build` command disables network access

Only if building with sandbox enabled. Can disable it if network access is required. Seems someone opened an issue asking[1] for granular permissions (explicit network restriction) but has been marked as stale. In same issue someone else has made comment providing an hybrid approach.

Since you mentioned Julia, it's possible to build Julia environments (with arbitrary packages) using the `.withPackages` function. E.g. `julia.withPackages ["Plots"]`.

[1]: https://github.com/NixOS/nix/issues/4584

Re: Show HN: Brioche – A new Nix-like package manager

#20
post #11

I'm also exploring a post-Nix package manager, wip: https://github.com/porkg/porkg My mantra has been to avoid "getting bored" and inventing DSLs for the longest time. I initially sought to use Nickel-lang, but it was missing some features that would make it an ideal candidate for this. I started writing my own (you may find this in the history) before realizing "WTF are you doing writing another shitty DSL?" I have…

ooh, porkg looks pretty interesting, will definitely keep an eye on the project!

Definitely agreed about the lockfile ideas! I went with a fairly similar design, although I haven't really escaped the "rebuild the world" situation yet and I've rebuilt a _lot_ of copies of gcc from source by now! (that's also partially because I set up the packages repo as a workspace[1], which I felt was easier to iterate on in the early days... I might eventually split each package into their own projects or separate repos so they can keep lockfiles independent of each other)

and yeah, I definitely felt the temptation to write my own DSL but I stayed strong! I just knew that it'd be a huge uphill battle, especially because I wanted to provide good editor support (IMO implementing a language is (relatively) easy, but implementing a language with good error messages and LSP support is crazy hard)

[^1]: https://brioche.dev/docs/core-concepts/workspaces/

Post reply on HN