4 ms·
> Crazy thing about NixOS is that it's so good, all the bad parts can be excused. I like to go on forums and complain about how the Nix configuration language
by m45t3r 5y ago
> Crazy thing about NixOS is that it's so good, all the bad parts can be excused. I like to go on forums and complain about how the Nix configuration language is horrible, and there's not much documentation on how to get general things done.
I don't think it is fair to say that Nix as a programming language is horrible, IMO, as a DSL it is pretty good and fits the domain well.
It is a strange language at first and it takes some time to learn all its quirks. Also, it lacks better tooling, things like LSP for example (there is one but it is slow and limited last time I tried). But just claiming the language is "horrible" is really unfair.
- easygenes 5y agornix-lsp is decent these days: https://github.com/nix-community/rnix-lsp https://github.com/nix-community/rnix-lsp
- m45t3r 5y agoThis is exactly what I meant with "there is one but it is slow and limited last time I tried", but it does seem that they made good progress (the last time I tried it was some months ago). Time to try it again.
- mindslight 5y agoThe semantics are great and necessary for Nix, but the syntax sucks. But syntax is the Afghanistan of programming languages, and all that.
- eximius 5y agoI think it's fair. It is, by far, the biggest hurdle to adoption and contributions. I'm a SWE and I don't grok it yet. Granted, I haven't spent a ton of time on it. But if you have to spend a ton of time on it, it has in some sense failed. It's harder to learn than literally any other language I can think of that isn't designed specifically to be esoteric. Most languages, after you have picked up a few, you can just glance at and you've got the basics. Nix is its own beast entirely. Edit: I do acknowledge that there is some difficult to manage inherent complexity. And, like many others, I love what Nix is trying to be. But I do think improving the language would be a big step.
- jml7c5 5y agoIn my experience, the biggest problems for learning Nix (the language) are the lack of type annotations and the tendency to separate function calls from function arguments. The first time you look in `my-package.nix` you find... a dict of function arguments? I think? What the heck? What function takes these arguments? What function arguments are valid? So you end up grepping the whole source tree for `"./my-package.nix"` just to see what functions are using it, and you find this construct: someFunction ./my-package.nix Which in other languages would be the slightly bizarre some_function( eval_file( "./my-package.foolang" ) ) So you're pretty sure these are arguments to someFunction, but it's weird that the call to `someFunction` wasn't in the same file, because it makes it hard to know what's going on. All of this this wouldn't be so unclear if the syntax wasn't visually similar yet semantically different from most languages. The map syntax in particular looks exactly like a block in curly brace imperative languages: { foo = "blah"; bar = foo + "blahblah"; } ---- Fortunately, there's work to separate Nix (the tool) from Nix (the language), so that any configuration language can be used to produce derivations. Nickel has been one of the drivers of this push: https://discourse.nixos.org/t/nickel-the-nix-language-spin-off/9592 https://discourse.nixos.org/t/nickel-the-nix-language-spin-o... https://github.com/tweag/nickel/issues/93 https://github.com/tweag/nickel/issues/93
- ris 5y ago> I'm a SWE and I don't grok it yet. I think the biggest difficulty most people have is that it's a pure functional language, and that is quite foreign to a lot of people, even many SWEs. It's something that's not going to change though because it's a fundamental part of why Nix works so well.
- whateveracct 5y agoThe Nix language is excellent imo Better than so many I use professionally