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