3 ms·
"Nix" refers to many things. Nickel specifically replaces the language that is called Nix. It has nothing to do with the package manager called Nix, the build s
by Smaug123 4y ago
"Nix" refers to many things. Nickel specifically replaces the language that is called Nix. It has nothing to do with the package manager called Nix, the build system called Nix, or the OS called NixOS.
- forgotpwd16 4y agoSo, will it replace the language called Nix or co-exist with it? How will Nix package manager and build system handle this new language?
- Smaug123 4y agoUndecided; see https://github.com/nickel-lang/nickel-nix https://github.com/nickel-lang/nickel-nix for a proof-of-concept of an integration that requires making no changes to either Nickel or Nix.
- pxc 4y agoWhether Nickel replaces the Nix language isn't up to Tweag, in the end. It's down to whether the Nix community finds it a compelling option. I, for one, am hopeful that it can preserve what is great about the Nix language and also offer a leap forward in debuggability and performance! But I don't think Nix's whole future hangs on it.
- notfed 4y agoNixlang is so alien that I've used NixOS for 2 years and still don't get it. Nickel looks much prettier than Nixlang, but it carries over a feature that still confuses me about Nixlang: variable declaration. Perhaps you can shed light on why it is the way it is. Why does it need to be of the format "let x = 5 in whatever(x);"? Why not, like Rust/F#/etc, allow the syntax "let x = 5; whatever(x)", i.e., allow the definition to stay in scope for the remainder of current block?
- Smaug123 4y agoI can only speculate, but I presume this is a historical detail from Standard ML.
- grumbel 4y agoEverything in Nix evaluates to a single value, including 'let' and even complete files. There are no blocks like in an imperative language. The '{}' in Nix are not blocks, but sets, known in other languages as maps or dicts. Thus what comes after the 'in' in a 'let' is an expression itself and has to return a single value. Meaning whenever you see a 'let', look at the surrounding, it will probably look like '{ a = (let x = 5; in x); }' which is just a convoluted way to write '{ a = 5; }'. Or often you'll see 'a = (foo: let ...)' in this case the ':' declares a function taking the argument 'foo'. You can play around with the language in the 'nix repl'. The language itself is really simple, but not very obvious when just looking at a code snippet it. And yes, there is an argument to be made that a purely expression based language is not very ergonomic, but it keeps the Nix language simple.