News for hackers. Stuff that matters.
Re:Spectrum OS: a declarative, reproducible, compartmentaliz... by mikepurvis on Tuesday September 14, 2021 @10:00PM (#28534308)
I started on my Nix journey a few months ago, and in some ways, I've had the worst-possible experience— I had basically no ramp-in period of being just a "Nix user" before attempting to write my first package, but was instead thrust immediately into a massive project templating out generated definitions for 1000+ interlinked packages with a bunch of oddball requirements, funky build tools, etc. I've needed to manage version and patch overrides, obscure linker conflicts, stuff that broke at runtime due to unpropagated buildInputs. I'm also a functional programming novice, so that recursive combinator magic which makes the overlay system work— also something completely new that I've had to wrap my head around.

So yes, all this has been... somewhat harrowing. But overall I would say I'm quite pleased with the end result and impressed with what Nix has enabled. Despite its long evolutionary growth, many of the things that I've encountered feel thoughtfully considered and well made. The various ways that builds and binaries can be pushed around and shared is awesome, and I'm excited for the optimizations coming with the content-addressed store.

I don't think that making the Nix language or package definitions feel more conventional would necessarily be a good thing— I think there's a risk that those kinds of changes obscure the underlying realities and lead to expectation mismatches.

That said, one thing that I do feel is pretty unfortunate is the interplay between the shell and Nix in package definitions. Basically you pass a dict to mkDerivation, and all the stringy items in that dict become available to your build's environment as envvars. This means when writing out strings for your configurePhase, buildPhase, etc, you have to be hyper-aware that ${thing} will be templated by Nix in the Nix context, whereas $thing will be templated much later, by Bash. It's something that is learned quickly but my goodness is it ever a hell of a tripwire.

Re:Spectrum OS: a declarative, reproducible, compartmentaliz... by iammisc on Wednesday September 15, 2021 @12:01AM (#28535127)
Nix needs a shell language integrated into nix. Nix should be usable as an os shell. That would make complex scripting so much easier than the weird passasfile bizarreness
Re:Spectrum OS: a declarative, reproducible, compartmentaliz... by rgoulter on Wednesday September 15, 2021 @03:56AM (#28536468)
What's the "weird passasfile bizarreness"?
Re:Spectrum OS: a declarative, reproducible, compartmentaliz... by mikepurvis on Wednesday September 15, 2021 @02:28PM (#28542569)
Per https://nixos.org/manual/nix/stable/#sec-advanced-attributes:

> passAsFile: A list of names of attributes that should be passed via files rather than environment variables.

Looks like it's basically just a hack for envvars that do/might exceed whatever bash's internal limits are for them.