6 ms·
A restricted purely functional language for configuration is a great idea. But why not a lisp? The syntax is well thought out, but who needs to remember yet a
by waldrews 3y ago
A restricted purely functional language for configuration is a great idea. But why not a lisp? The syntax is well thought out, but who needs to remember yet another set of syntax rules. And it's not like lisp syntax would scare off the Nix crow anymore than it scared off the Emacs crowd.
- nemoniac 3y agohttps://guix.gnu.org/ https://guix.gnu.org/
- exe34 3y agoI considered guix, but they seem a bit more religious about non-free. It might be cool to create a lisp->nix transpiler, but nixpkgs is in nix, and you spend a lot of time reading that when doing anything nix.
- Y_Y 3y agoTheir software freedom policy seems to be similar to Debian. All free by default, allow separate nonfree addon. In the case of Guix you can find that here: https://gitlab.com/nonguix/nonguix https://gitlab.com/nonguix/nonguix .
- exe34 3y ago> Please do NOT promote this repository on any official Guix communication channels, such as their mailing lists or IRC channel, even in response to support requests! This is to show respect for the Guix project’s strict policy against recommending nonfree software, and to avoid any unnecessary hostility. Hah, I wonder why I didn't come across it before.
- otabdeveloper4 3y agoNix-the-language is isomorphic to JSON, which makes a lot more sense than clinging to some outdated 1970's legacy.
- waldrews 3y agoLisp originated in 1958. We don't need any of that new-fangled 1970's stuff.
- aidanhs 3y agoCan you elaborate on what you're getting at? Syntax-wise it's about as similar to JSON as Erlang expressions are (i.e. superficially similar in some cases). Semantics-wise I've personally found any superficial similarity to JSON to be actively unhelpful in understanding because of some important processing differences (e.g. paths, laziness).
- maxcoder4 3y agoAgreed. I've tried to write a json-nix converter (because I wanted to try configuring my system in jsonnet) and it's absolutely not easy, or obvious how to do this.
- waldrews 3y agoThe FunctionalScript language is supposed to be a superset of JSON and a subset of Javascript that's pure and functional. Not sure that's suited to the use case Nix is going for, but that sounds like what we'd get if we took the extended-JSON path.
- otabdeveloper4 3y agoJSON is not a language, it's a data representation. Nix data is equivalent to JSON, except Nix also has a "path" datatype.
- aidanhs 2y agoFirst a minor quibble: if you're talking about 'Nix data', then starting the conversation by talking about 'Nix-the-language' is rather misleading. That aside, Nix allows you to create infinite datastructures, e.g. $ nix eval --expr 'rec { z = { a = z; i = 5; }; }.z.a.a.a.i' 5 which you can't do with JSON. But even if JSON did have some way of handling datastructure 'loops', it's still not helpful because of laziness. You almost never want to eagerly evaluate a Nix expression to produce what you seem to term 'Nix data', because you'll invoke the `derivation` built in function to create paths you never actually reference - this is why laziness is such an important property of Nix. So I'm still not clear what user-facing part of Nix is isomorphic to JSON. If it's just "Nix types [0] are similar to JSON types" then...sure. [0] https://nixos.org/manual/nix/stable/language/values https://nixos.org/manual/nix/stable/language/values
- maxcoder4 3y agoAs a NixOs lover and user, nix-the-language is my least loved feature of the ecosystem. But at a user is not a big problem because I only write configurations for myself, and it's not like my OS configuration is a proper program, it's closer to data. One upside is that because it's hard to write complex programs in nix, people don't do it (unless really needed). So the nixos tutorials and configuration examples on the internet are usually pretty simple. This is good for beginners, and nixos is already a huge undertaking. With lisp I'm sure many of us would get crazy with abstractions.