4 ms·
Yes and no. Fundamentally, I agree with you. Nix is hard because it solves an inherently complex problem. But it's also hard because it has some usability flaws
by Cu3PO42 3y ago
Yes and no. Fundamentally, I agree with you. Nix is hard because it solves an inherently complex problem. But it's also hard because it has some usability flaws.
For example, I recently wrote a bunch of Nix and got an error that boiled to me forgetting to add a "name" to a derivation. That is absolutely my bad. However, Nix didn't tell me which file this derivation was in (it said 'unknown file' iirc), the stack trace also wasn't any help . And so I went hunting through the hundreds of lines of Nix I just added to find where I might be missing a "name".
Should I have tested my code incrementely? Absolutely, yes! But Nix should also be able to tell me which file I am missing the attribute in.
I say all of this as a huge Nix advocate and fan. It's wonderful, it solves so many problems I previously had and I intend to keep using it, but it's far from perfect.
- jfoutz 3y agoReminds me of in the beginning was the command line. Powerful tools, but they’ll rip your arm off. Learning nix, slowly, really enjoying it though.
- smasher164 3y agoYeah in many ways, Nix is a research project that escaped the lab. It’s the first tool of its kind that also happened to become successful. You have to write in this dynamically typed Haskell with poor affordances for being a build system and fragmented ways of addressing pinning.
- akavel 3y agoFWIW, Nickel is one attempt from the Nix community at creating a Nix-like language with static typing, as well as better error reporting I believe: https://nickel-lang.org https://nickel-lang.org As far as more loosely related technology, there's also https://cuelang.org https://cuelang.org, which is... something different.
- unshavedyak 3y agoMan i can't wait for Nickel to work with Nix. Feels impossibly difficult though. I often think that making Nix logic + configuration is just a mistake. I kinda feel like i'd prefer something that output a JSON-like config, and that config was a deterministic instruction for my stuff. I know why that sounds impossible or big or difficult or etc. but as a user, i often am writing something that walks and talks almost and so damn close to JSON. Most of it looks like simple configuration. But can i print a damn JSON object? Hell no. Because there's lazy function calls all over the place. They managed to make something (and other similar langs) that looks like clean readable configuration, but acts like some obtuse bespoke logic where you can't know what anything is without running it - and running it to see output is weirdly difficult. I am on Nix, but i kinda think there's more than one fatal flaw. I adore what they've done, but there has to be something better and more enjoyable as a system configuration.. i hope. It's probably a tooling problem. I get that. But still.. i just want to see some configuration output. Why is that so hard?
- Cu3PO42 3y agoI'm rooting for Nickel, I really am, but I am doubtful. Nix is so incredibly dynamic that I believe it's nearly impossible to give it a practical static type system. I say practicaly because I do believe it is possible to come up with a reasonable type system, it's just that it would be so complicated to use that hardly anyone actually would outside of extremely specific applications (see Agda, Idris, ...). In order to get something more reasonable, I think we would also need to rethink both the NixOS module and nixpkgs DSLs. Which is of course possible, but such a momentous task that I don't see it gaining much traction. I think it's more realistic, and maybe even sufficient to integrate better error reporting into Nix itself. This is surely also no easy feat, but I am confident some improvements could be made: for example, more acurate tracking of source locations. And while I almost always prefer static over dynamic typing, writing a specific NixOS config feels like it's one of the moments where it's less important, because I don't care about all possible executions working, I just need my specific config to work. This all changes once you write your own modules, where you obviously want all configurations to work, but that is less important for end user adoption IMO.
- PrimeMcFly 3y agoI had thought the Nix 'language' was just a way to describe packages, dependencies and configs, more a config format than a language. Why would it need static typing?