Live data from Hacker News

Typing Nix

tweag.io

21–30 of 128 posts

Re: Typing Nix

#21

How does Nix compare with conda[0] ? I could not find any useful resource, in my team we were hesitating between the two, for packages management ; finally we went for conda because it (seems)is better documented and package description is easier to write for newbies. And also we are a Python shop, so other devs felt more comfortable with conda. Personally I prefer Nix, though, and I wanted to advocate for it but the…

I wrote this document: http://catern.com/posts/deps.html which briefly compares both Conda and Nix among other things.

(warning: it's very pro-Nix :) )

Re: Typing Nix

#22

Earlier quoted context omitted.

You tried guix ? I still have a fondness for sexps, but ML would be nice too.

I need CUDA drivers for what I am working with, and I have found no way to install it in Guix. Otherwise, it looks interesting enough. (Sexps are usually not my first choice, I think it is a "lazy option" for people who do not want to write parsers / design their own syntax. Even then, they are better than current Nix expressions).

Some academics say that sexp allow to focus on what's important: semantics. I kinda agree with that, so many time, effort is wasted on syntax that moves, and only make ideas further apart.

Anyway, thanks for the answer

Re: Typing Nix

#23
post #6

I love Nix. NixOS is my primary development operating system. However, the Nix language itself is syntactically ugly , and this proposal makes it even uglier. Parentheses, sigils and special characters (esp. semicolons) are line noise — the less of it the better. Why they wouldn't take the most (syntactically) beautiful functional programming language out there — Standard ML? It would work perfectly for such a task.…

If I only look at the language properties then Nix makes sense to me. The fact that Nix is lazily evaluated allows for easy composability. This is used a lot in nixpkgs to allow overrides and build up packaging layers. And because the language is interpreted, only the files that are being used need to be evaluated. It wouldn't be very practical to hold all of nixpkgs in memory. It also allow to do things like dynamically import code from another git repo. And finally, the language only allows side-effects through derivations.

None of the above language have all these properties combined.

Re: Typing Nix

#24
post #6

I love Nix. NixOS is my primary development operating system. However, the Nix language itself is syntactically ugly , and this proposal makes it even uglier. Parentheses, sigils and special characters (esp. semicolons) are line noise — the less of it the better. Why they wouldn't take the most (syntactically) beautiful functional programming language out there — Standard ML? It would work perfectly for such a task.…

I could not agree with you more! I use nix daily, and every time I go to edit it a nix file a voice in the back of my head says, "you should really start that Haskell to Nix compiler you've been thinking about." [edit] ha! just notice the next comment talking about hnix. Great minds... :)

You might be interested in dhall[0] and dhal-to-nix[1] which provides a really neat haskell-like language that compiles to nix.

[0]: https://github.com/Gabriel439/Haskell-Dhall-Library [1]: https://github.com/Gabriel439/Haskell-Dhall-Library

Re: Typing Nix

#25
post #20

Earlier quoted context omitted.

Is there any option to break source-level compatibility? (Automatic translation to old syntax will still be possible and seamless, of course). If yes, I can draft a proposal.

Unfortunately no, except maybe for some very minor tweaks that have a chance to be included in vanilla nix, but otherwise this would most probably either mean the death of this project or a split in the (already small) community, which I both don't want to see

Community could be larger if all these petty things were resolved :) But I understand, forking is definitely not an option.

So, if only gradual changes are allowed, I would have started with:

- making semicolons optional

- commas for implicit array literals (e.g. "a", "b", "c" in lieu of ["a" "b" "c"]

- something to do with 'with' / 'in' syntax.

In fact, I can live with anything, except non-optional semicolons. Is there a possibility to infer them?

Re: Typing Nix

#26
post #6

I love Nix. NixOS is my primary development operating system. However, the Nix language itself is syntactically ugly , and this proposal makes it even uglier. Parentheses, sigils and special characters (esp. semicolons) are line noise — the less of it the better. Why they wouldn't take the most (syntactically) beautiful functional programming language out there — Standard ML? It would work perfectly for such a task.…

Honestly that's the only thing that keeps me from jumping to NixOS. I don't want to learn a weird language, I'll never use for anything else, just to maintain my OS.

The language is so simple you can learn all of it in a day. Read through chapter 15 in the nix[1] manual and that's it.

To me it doesn't feel weird at all: I can't think of any feature that was new or surprising when I started using it and I am not the biggest expert of functional programming. You have to learn more about the standard environment and tools if you want to start contributing to nixpkgs and write your own packages but if you only care about configuring your system nix is as difficult to learn as say, JSON.

[1]: https://nixos.org/nix/manual/#ch-expression-language

Re: Typing Nix

#27

Earlier quoted context omitted.

I need CUDA drivers for what I am working with, and I have found no way to install it in Guix. Otherwise, it looks interesting enough. (Sexps are usually not my first choice, I think it is a "lazy option" for people who do not want to write parsers / design their own syntax. Even then, they are better than current Nix expressions).

Some academics say that sexp allow to focus on what's important: semantics. I kinda agree with that, so many time, effort is wasted on syntax that moves, and only make ideas further apart. Anyway, thanks for the answer

Well, right, but we are not talking about an academic paper here, we talk about practically convenient language. If syntax is unimportant, we could leave Nix files as is -- semantically, it is a good programming language. But judging from the comments, I am not the only one who thinks that syntax and overall esthetics are important.

Re: Typing Nix

#28
post #26

Earlier quoted context omitted.

Honestly that's the only thing that keeps me from jumping to NixOS. I don't want to learn a weird language, I'll never use for anything else, just to maintain my OS.

The language is so simple you can learn all of it in a day. Read through chapter 15 in the nix[1] manual and that's it. To me it doesn't feel weird at all: I can't think of any feature that was new or surprising when I started using it and I am not the biggest expert of functional programming. You have to learn more about the standard environment and tools if you want to start contributing to nixpkgs and write your o…

It is definitely not difficult to learn, just somewhat hard to read and visually unappealing :)

Re: Typing Nix

#29
post #20

Earlier quoted context omitted.

Is there any option to break source-level compatibility? (Automatic translation to old syntax will still be possible and seamless, of course). If yes, I can draft a proposal.

Unfortunately no, except maybe for some very minor tweaks that have a chance to be included in vanilla nix, but otherwise this would most probably either mean the death of this project or a split in the (already small) community, which I both don't want to see

Can't it just accept two different syntaxes (if really necessary for disambiguation, perhaps requiring people to put some magic string at the beginning of the file to request the new syntax)?

Re: Typing Nix

#30
Isn't containerization / Docker meant to solve this problem of configuration managers leaving machines in an unknown state? Nix seems to be a bandaid to config management solutions and is yet another kinda config management solution.
Post reply on HN