4 ms·
Nickel Modules
- hislaziness 2y ago[flagged]
- deleted 2y ago[deleted]
- mtlynch 2y agoThere's no explanation of what Nickel is. Even if I click the link, I get: >Better configuration for less >Write complex configurations. Modular, correct and boilerplate-free. I still don't get what this is. Configuration for what? Is this an alternative to TOML/YAML? From clicking three or four links deep into the Nickel documentation, I finally found an explanation that Nickel is a language for generating configuration files like YAML or TOML. Either I'm super out of the loop or the authors need to do a better job of explaining what Nickel is from the beginning.
- anon291 2y agoNickel is a replacement for the Nix programming language
- yagrouze 2y ago(disclaimer: Nickel dev) Thanks for the feedback. It sounded obvious to me, but I reckon that after looking at the website again, it's never spelled explicitly really on the front page. Nickel is a domain-specific programming language for configuration. Similar to CUE, Dhall, Pkl, Jsonnet or the Nix language. With typing and validation capabilities built in. I like to think of it as "configuration templating done the right way". While it originally targeted Nix in particular, it's a standalone config language that can be used to generate YAML or the like for e.g. Terraform, Kubernetes or anything where using pure YAML (or ugly unplanned semi-programming languages disguising as YAML) isn't enough.
- mtlynch 2y agoCool, thanks for the additional context! As someone who is a Nix beginner and struggles with the language, I'd love to see an alternative that's easier to use. Is Nickel at the point where it is a viable alternative for Nix than the Nix language? Is there any documentation about configuring Nix with Nickel?
- viraptor 2y agoIf you don't like the Nix language, you're unlikely to like Nickel - they're very similar.
- yagrouze 2y agoI wouldn't say they are very similar. Nix is a fairly barebone functional language, so it does embed fairly straightforwardly into other functional languages (including Nickel, but it's true for Haskell, OCaml, Dhall, Jsonnet, Scala, etc. as well - forgetting about Nix-specific builtins, as long as you have higher-order functions, records and arrays, you have the Nix core). However, Nickel adds pattern matching and destructuring, reverse application, types, contracts and merging, which I think does lead to a quite different experience in practice. It's a bit like saying that C is similar to Rust (ok, so the analogy doesn't work as well for Rust as most C would be unsafe on non-idiomatic Rust) or C++: in some sense, yes, but developing in those languages is very very different.
- k_bx 2y agoIn Nix, I've found that the biggest problem is not the language but the lack of easy introspection. Which keys are present in the struct I'm looking at? What are all the symbols in point X? Etc. It felt like an "ok to read but hard to write" language. I think it's resolved by a proper IDE and runtime-inspection of some kind.
- pxc 2y agoI would weaken and expand this a bit. 1. If you like Nix, you'll probably like Nickel, too. 2. If you use Nix enough that there are enough specific things you hate about it to comprise a wishlist, you might be extra excited about Nickel for checking some of those boxes. 3. If you looked at Nix code for 5 minutes and instantly bounced off it because it seemed alien and unpleasant, Nickel might give you similar feelings. I think (3) often resolves itself with experience, so it's potentially worth coming back to Nix or Nickel in a more patient and curious mode, if you've had that reaction.
- wrasee 2y agoSame. It was only when I got to reading the user manual that I see what I feel could be the first sentence of their website > Nickel is a generic configuration language. > Its purpose is to automate the generation of static configuration files - think JSON, YAML, XML, or your favorite data representation language - that are then fed to another system. It is designed to have a simple, well-understood core: it is in essence JSON with functions. https://nickel-lang.org/user-manual/introduction/ https://nickel-lang.org/user-manual/introduction/
- oldpersonintx 2y ago[dead]
- aliasxneo 2y agoI wonder how much Nickel has improved since last year. I attempted to use it to generate some Terraform code, and the experience was less than pleasant. This was largely due to surprising interactions and lack of documentation, ironically making it similar to Nix. I'm hopeful it will keep improving.
- unshavedyak 2y agoComing from Rust, there's still something about those Nickel error messages that don't read as well for me. They're much better than Nix for me, but weirdly they still read a bit busy. Maybe it's just my brain heh.. i can't explain it. Nonetheless I still am just dying to switch to Nickel from Nix though. I am so tired of not having types in my config language, crappy documentation available to my LSP, etc. The wait for Nickel has been long for me
- VTimofeenko 2y agoNix improved error reporting around version 2.20[1]. Specifically the dreaded infinite recursion can now be traced back to the code that caused it without poring over the whole stack trace. Contracts in nickel are much better IMHO. 1: https://nix.dev/manual/nix/2.22/release-notes/rl-2.20 https://nix.dev/manual/nix/2.22/release-notes/rl-2.20
- 1oooqooq 2y agoi bet this nickel language is awesome and versatile, but that their own employees have hidden bash and python hacky scripts that generate what amounts to 90s-Oracle-consultant-xml levels of verbosity for simple config files just so you can have a test db for ci builds in the end.