News for hackers. Stuff that matters.
Re:How Nix and NixOS get so close to perfect by mananaysiempre on Sunday April 24, 2022 @04:43AM (#31142276)
> Using Haskell as a base for the syntax

I don’t really think this is a problem at all? I mean, at the particular design point the language occupies there are basically three possibilities:

- Kind of like Lisp (parens everywhere, painful with pervasive currying);

- Kind of like ML (var and fun everywhere);

- Kind of like Haskell.

Nix is chooses the last of those, and it does not have most of Haskell’s funkiness: no “alignment”-based blocks, no custom operators, no separate type sublanguage. The merged string interpolation / field lookup thing looks kind of funny, but has nothing to do with Haskell. The scoping rules for 'with' are weird, but, first, are not syntax, and second, have nothing to do with Haskell either.

Really, if one were to design the language that fits Nix’s description—a dynamically-typed (not Dhall), lazy (not Guix) higher-order (not CUE) language with a JSON data model—I don’t see how it would look much different. It could be less consistent, it could have more infix operators for things, or it could use a list concatenation operator that is not like anything instead of like Haskell. That’s it? If anything, any alternatives I can think of would be less conventional and/or more Haskell-like.

Re:How Nix and NixOS get so close to perfect by KronisLV on Sunday April 24, 2022 @05:21AM (#31142446)
> I don’t really think this is a problem at all? I mean, at the particular design point the language occupies there are basically three possibilities:

How so? Where's the Java/Python-like languages in this consideration, why wouldn't those work? Or something more like Ansible?

I'm pretty sure that you can express the same concepts for the most part in something imperative as well.

Re:How Nix and NixOS get so close to perfect by cwp on Sunday April 24, 2022 @06:07AM (#31142659)
Yes and no. Yes, because Turing completeness. But no, because if you tried to do something like the Nix package manager with a language like Python or Java or even Scheme (yeah, I'm looking at you Guix), you'd end up with a worse system.

What's great about Nix the language is that its design matches beautifully with its purpose. Nixpkgs is a single giant program, the output of which is a set of 70,000 package definitions. Since Nix uses lazy evaluation, you can specify one of the attributes of that set, a single package, and the Nix interpreter will evaluate just that one package expression. Of course, if that package depends on other packages, those will get evaluated as well, because they're needed as inputs to the package you care about. So package dependencies emerge naturally as computational dependencies between function invocations. This is really powerful, and over the years, Nixpkgs has evolved more and more sophisticated ways of defining packages - package overrides, the overlay system, and most recently, flakes.

So yes, using an imperative language would technically be possible, but I doubt that you could use it to build the largest and freshest package repository with a fraction of the contributors that other packaging systems have.

Re:How Nix and NixOS get so close to perfect by tjoff on Sunday April 24, 2022 @07:37AM (#31143084)
I really struggle with selling argument of lazy evaluation in the nix context, it is not a big deal. Sure, nix has been built around it, but it could just as well have been built around something else. And most certainly can't see how that would influence the number of packages.

And honestly, the package situation is the biggest downfall of nix(os), there are tons of packages, yes. But they are often buggy (simply because nix is so different), not maintained (understandable, people move on), or plainly missing (because the few maintainers don't cover even popular niches). Of course that is going to be the case for a new system, but I'm flabbergasted every time it is being touted as an advantage of nix(os). And I feel that it is quite counter-productive tricking people into the ecosystem and giving the impression that it is on par or even better than any mainstream OS. It is making great progress, but it has a long way to go.

Re:How Nix and NixOS get so close to perfect by ris on Sunday April 24, 2022 @07:55AM (#31143201)
> And honestly, the package situation is the biggest downfall of nix(os), ... but it has a long way to go.

I have a big problem with "it has a long way to go" arguments. "It has a long way to go" in comparison to what? Every project I know of could be described as having "a long way to go".

If we're comparing it with ubuntu/debian, there are few packages that ubuntu/debian have that nixpkgs is missing. On the other hand, what's the status of getting kubernetes in ubuntu/debian? Last I heard it was mired in https://lwn.net/Articles/835599/. And what happens if you use the ubuntu/debian prometheus package? You currently get a version that many people would consider "too ancient to be useful". I could easily use these points to argue that debian has "a long way to go".

The real answer is "they're different". It's a mistake to think the two are just trying to replicate each other piece for piece.

The same goes for people arguing that the linux desktop has "a long way to go", whether they were making that argument in 2001 or 2021.

Re:How Nix and NixOS get so close to perfect by tjoff on Sunday April 24, 2022 @08:05AM (#31143266)
> I have a big problem with "it has a long way to go" arguments. "It has a long way to go" in comparison to what? Every project I know of could be described as having "a long way to go".

In comparison to any other mainstream OS nixos is going to have a lot of friction for most usecases. That is what I mean with it having long ways to go.

Part of that is configuration.

Other part of it is the package system being very immature. It is a direct consequence of the massive task nix has set out for itself, but that isn't always comforting for the end-user. And oh boy, the situation with looking for github-issues for packages is a freaking nightmare.

Just because nixos has a package for it doesn't mean that it does what it should or is up to date. That of course isn't the case for any package management system. But, all other mainstream OSes have matured. Nixos has a long way to go.

I love nixos, it is my main driver on my laptop and I run many VMs with it. If the future isn't incorporating the selling points of nixos I'm going to be dissapointed. But unless you want your OS to be your hobby I most certainly would not recommend nixos.

Nixops is another things that disappoint me / has long ways to go. It is the logical extension of what nixos is and it isn't really mature. There are lots of competing efforts for it and as someone willing to really invest time in it I just get exhausted.

Re:How Nix and NixOS get so close to perfect by sshine on Sunday April 24, 2022 @08:52AM (#31143480)
I run Ubuntu and MacOS because I don’t want my OS to be my hobby. I’ve run LFS, Slackware, Gentoo, FreeBSD, OpenBSD, Arch, Ubuntu Server (on laptop). I’ve spent a lot of time tweaking Xmonad, custom keyboard layouts, etc.

I would love for a distro with declarative configuration management. But I don’t have time for more hobbies right now.

Re:How Nix and NixOS get so close to perfect by emteycz on Sunday April 24, 2022 @06:16AM (#31142698)
Well said. Using imperative language would be possible but then it'd look like a bunch of function invocations, not like a class declaration. And people would be asking "this is crazy, why don't you create a DSL for this? My IDE can't ever understand this".
Re:How Nix and NixOS get so close to perfect by daptaq on Sunday April 24, 2022 @01:23PM (#31146115)
> even Scheme (yeah, I'm looking at you Guix), you'd end up with a worse system.

This is the first time I would have heard that point of view, could you elaborate?

Re:How Nix and NixOS get so close to perfect by deltaonefour on Sunday April 24, 2022 @11:38AM (#31145067)
It can be done without the language itself having lazy evaluation. Each package can just have a function that outputs some data structure and the lazy evaluation happens on the package builder.
Re:How Nix and NixOS get so close to perfect by soraminazuki on Sunday April 24, 2022 @04:34PM (#31148055)
The Nix language's main concern is handling large scale configuration. General purpose programming and scripting is completely out of scope.

The Nixpkgs repository has over 80,000 packages [1] contained in a single key-value store. The design of the Nix language not only makes this sustainable, but even compelling. For one thing, Nix package descriptions are composable and easy to manipulate programmatically. It's common practice to create new packages on the fly out of existing package definitions, and it's what the Nix language is particularly good at. Things like this add a lot of complex inter-dependencies within the Nixpkgs code base, and it still manages to be comprehensible.

The same approach isn't practical with general purpose imperative programming languages. A quick glance at Nixpkgs repository reveals that it contains over 2.4 million lines of Nix code. Imagine that much Java/Python code manipulating a single global mutable data structure. It can only result in a nightmare.

Additionally, the notion that the Nix is Haskell and is therefore incomprehensible is an often repeated meme without any backing details and needs to stop. If any language is similar to Nix, it's Jsonnet. But I haven't seen a single person criticizing Jsonnet [2] for being Haskell. If you can understand JSON and have no problem writing functions for any common language, then there really should be no problem learning the Nix language.

[1]: https://search.nixos.org/packages [2]: https://jsonnet.org

Re:How Nix and NixOS get so close to perfect by colordrops on Sunday April 24, 2022 @05:40AM (#31142529)
I don't see how you could maintain purity and reproduceability with something imperative. I used ansible for a while and it was a mess that broke half the time and was difficult to maintain.
Re:How Nix and NixOS get so close to perfect by tracnar on Sunday April 24, 2022 @07:13AM (#31142962)
Doesn't Bazel do exactly that with their Starlark language based on Python?

https://bazel.build/rules/language#mutability

Re:How Nix and NixOS get so close to perfect by pharmakom on Sunday April 24, 2022 @03:24PM (#31147362)
Key aspects of Bazel are not imperative. For example the “load” functions commands must not be computed.
Re:How Nix and NixOS get so close to perfect by deltaonefour on Sunday April 24, 2022 @11:48AM (#31145182)
You can. So long as the impurity is scoped to be local within a package. And the system itself only reads the output of your language to configure something. Example:

  def packageInstaller(pkgs: Pkg) -> Derivation:
      x = {
          req: [pkgs.a, pkgs.b]
          build: 
          ...
      }

      x[req].append(pkgs.c)
      return buildDerivation(x)
packageInstaller outputs a single package description, but you can also create something similar that easily outputs an entire configuration for the OS. You just need to keep mutation scoped within the language. The configuration that is outputted is immutable and whatever thing that's processing that configuration is not within user control.

Keep in mind that mutability and immutability share a certain isomorphism. Within the nix expression language you often do something similar to mutation just as any other functional language. For example:

    listVersion3 = listVersion1 ++ AdditionalStuff
It's just that in functional languages you're forced to keep versions of each mutation.
Re:How Nix and NixOS get so close to perfect by tjoff on Sunday April 24, 2022 @07:54AM (#31143195)
How does that have anything to do with it being imperative and not the fundamental design of the system?

How nix is architectured is exactly why it achieves purity and reproducibility, not the configuration language. It isn't even a goal of ansible in the same sense, per design.

The building blocks of nix is simple, of course it can be implemented in something imperative.

Re:How Nix and NixOS get so close to perfect by xena on Sunday April 24, 2022 @08:00AM (#31143236)
Think about it like this: with Ansible you start from some unknown state of the system and then iteratively do actions to hopefully get what you want. With Nix you know what the base state of the system is, and the configuration language lets you describe your desired end state. Then the computer figures out what to do in the middle.

The fundamental design of Ansible is that you do imperative steps to reach an end state. The fundamental design of NixOS is that you describe the end state and the compiler derives the intermediate steps.

Yes, normally things work out with Ansible, but the devil is in the details and can involve a lot of fighting configurations that are non-cromulent.

Re:How Nix and NixOS get so close to perfect by tjoff on Sunday April 24, 2022 @08:09AM (#31143296)
Yes - that was exactly my point. It has nothing to do with the configuration language. The end result of nix(os) could just as well be done from a bash script (not advisable, no).

And the problems with ansible would not be any better off if they had used something like the nix-language instead.

Re:How Nix and NixOS get so close to perfect by xena on Sunday April 24, 2022 @08:12AM (#31143310)
Fun fact: Nix is really a compiler from a weird Haskell like DSL to bash!
Re:How Nix and NixOS get so close to perfect by sciurus on Sunday April 24, 2022 @02:42PM (#31146920)
> The fundamental design of Ansible is that you do imperative steps to reach an end state.

No, the fundamental design of configuration management systems (Ansible, Puppet, Chef, Salt, CFEngine) is that they are declarative. You say "this software should be installed, this user should exist, these files should have these contents and permissions, etc" and they figure out the right steps to take on your OS to move from the current state to your desired end state.

You are right though that they can produce unexpected results since they do not describe the entire system from the ground up.

Re:How Nix and NixOS get so close to perfect by soraminazuki on Sunday April 24, 2022 @05:10PM (#31148377)
I deal with Chef at work, and I wish that was even remotely true. It's not a declarative system at all because it does not have the properties of being one. Namely the part about being able to specify the end state.

Chef doesn't allow you to specify the end state. Instead it allows you to specify a list of actions to be taken during deployment. The end result is affected by bunch of external inputs sent from the Chef server and every single bit of state the target server is able to observe. It is therefore impossible to reliably determine the end state of the target server before deployment. Our team has been burnt by this more than once.

Other similar systems are more or less the same. They have every hallmarks of being an imperative system.

Re:How Nix and NixOS get so close to perfect by colordrops on Sunday April 24, 2022 @03:18PM (#31147280)
That's fair, though ansible has ordered steps, so it's not entirely declarative.

You are right that imperative definition is not a problem for reproduceability, but it does make things harder to reason about since you have to mentally keep track of state between steps.

Re:How Nix and NixOS get so close to perfect by ris on Sunday April 24, 2022 @08:01AM (#31143247)
> Or something more like Ansible?

If you make it more like Ansible, you will end up with ... Ansible.

If you want to use Ansible you are perfectly welcome to, but as a Nix person the entire Ansible way looks like a completely wrongheaded approach to system management.

Re:How Nix and NixOS get so close to perfect by sshine on Sunday April 24, 2022 @08:59AM (#31143531)
If manual Linux server maintenance is like working with clay, Ansible is like a clay gun. It works great when you have to initiate work on a server you have limited control over; e.g. one that is provisioned from a cloud provider. And where I don’t need more than a few commands, and never need to replay them.

Ansible is “bottom-up” (you start in the middle of a server’s lifetime without knowing everything); many more cloudy solutions like Kubernetes assume that a bunch of infrastructure is already set up; container registries, build servers, and the control plane.

My first Ansible use-case was to install K3s on a dedicated machine where I could only choose the OS image from a few options like Debian and CentOS.

Re:How Nix and NixOS get so close to perfect by mananaysiempre on Sunday April 24, 2022 @09:12AM (#31143616)
You could make a package manager or distribution along the principles of Nix with any reasonable language, of course. Insisting on first-order data (i.e. not functions) exclusively would probably have the standard problems of trying to cram into a declarative configuration something that really wants to be a program (“YAML ops”, programs-as-SQL-tables disasters like Windows Installer, XML hells like Ant and XSLT, etc.); but once you go all the way to a general programming language, sure.

I would probably prefer Lua to Python because while Python can sort of do declarative EDSLs they invariably suck, and the expressive power and general style of the two is largely similar; Java has all those problems times a hundred so I expect you would end up staging the whole thing into a config processor in Java and a config in something else; but while the ergonomics may vary it’s certainly not impossible. Guix, Pacman with Aconfmgr, or the venerable GNU Stow are all this to some degree.

That is not what I was saying, though. The semantics of the Nix language (JSON-like data model, lazy, higher-order, dynamic types) are a vital part of the implementation approach taken by the Nix package manager, and once those semantics are fixed the syntax (so I argued) has to be broadly similar to what it is now. (You could force a Java- or Python-like syntax upon an ML- or Scheme-like language if you really wanted, but the result would just be miserable to program in; the F# people tried but mostly gave up.)

Is that approach the right one? I suspect so, but it is still to early in the life of the whole idea to be really sure. The idea that a dynamically-typed lazy (thus pure) higher-order language is a good middle ground between a completely declarative configuration and a completely imperative setup script (neither of which can usually stand alone) is a fresh and interesting one, and I’d very much like to see it explored. I’ll be the first to admit that the documentation on Nix internals is lacking, but once the requisite source spelunking is done it’s delightful how the whole thing comes together and how much flexibility being written in itself affords it. (Did you know that NixOS was originally a fun experimental addon to the whole thing? The packaging language accidentally ended up being powerful enough to make a usable and novel system configuration language.)

But the complaint seemed to be that the syntax (which is relatively superficial and does not require particularly deep argumentation) is Haskell-like, not that the implementation approach (which is crucial to the whole design and requires arguments on the scale of a research paper) is wrong. My point was that the latter pretty much implies the former.

Re:How Nix and NixOS get so close to perfect by pharmakom on Sunday April 24, 2022 @03:32PM (#31147454)
> the result would just be miserable to program in; the F# people tried but mostly gave up.

Huh?

Re:How Nix and NixOS get so close to perfect by yakak on Sunday April 24, 2022 @07:04AM (#31142917)
> Or something more like Ansible?

This seems to be the argument that comes up over and over with go, JavaScript, Ansible, etc. Sure one can take an imperative language and try to follow FP principles to emulate good things. Then one is comfortable with how it works while not really understanding FP and when it trashes the system by being implemented as a sequence of trashes of the state it is just a learning experience of user error.

Re:How Nix and NixOS get so close to perfect by danmur on Sunday April 24, 2022 @07:07AM (#31142931)
I love many aspects of Nix but for me at least the language is a barrier. I spend time and get better at it but there's a fine number of things people can spend that time on.
Re:How Nix and NixOS get so close to perfect by 0des on Sunday April 24, 2022 @07:41AM (#31143113)
JSON would be a nice way to make a config file. I say this as an xmonad user too, which does its configs in Haskell as well. I love Haskell its just I don't want it to be my config language
Re:How Nix and NixOS get so close to perfect by stavros on Sunday April 24, 2022 @07:49AM (#31143166)
I don't think JSON is a nice way to write config files at all. You can't even add comments. I'd much prefer something like Cue.
Re:How Nix and NixOS get so close to perfect by xena on Sunday April 24, 2022 @07:55AM (#31143203)
I think the hard part here is using enough of a type system to ensure data sanity but not so much of one that you drown in metadata. I'm not really sure of a proper compromise like that.
Re:How Nix and NixOS get so close to perfect by stavros on Sunday April 24, 2022 @07:57AM (#31143214)
Yeah, fair point. I don't know Cue well enough to know how much drowning there is, from my limited understanding you can specify as many types as you want and leave the rest dynamic, but I'm not sure at all.
Re:How Nix and NixOS get so close to perfect by dotancohen on Sunday April 24, 2022 @08:18AM (#31143345)
So long as the parser doesn't except on undefined keys, you can add pseudo-comments to many places in a JSON config file.

  {
    "foo": "bar",
    "COMMENT": "This bars the foo"
  }
Re:How Nix and NixOS get so close to perfect by viraptor on Sunday April 24, 2022 @09:03AM (#31143561)
That still doesn't let you comment on items in the list, or on elements of actual maps - for example if those were environment variables, now you've got a random "COMMENT" variable.
Re:How Nix and NixOS get so close to perfect by dotancohen on Sunday April 24, 2022 @10:59AM (#31144640)
Sure, it's a hack, but it's a useful hack that works in many places.
Re:How Nix and NixOS get so close to perfect by ithkuil on Sunday April 24, 2022 @08:22AM (#31143359)
If it doesn't error in undefined keys you cannot help people figuring out when they introduced a typo in their config
Re:How Nix and NixOS get so close to perfect by OJFord on Sunday April 24, 2022 @08:13AM (#31143314)
How about HCL? (Hashicorp Configuration Language, as used in Terraform for example.)

It's not really 'kind of like' any of Lisp/ML/Haskell IMO, and a good fit I think. Maybe it wouldn't allow everything or easily, but then if we're already only talking about being 'kind of like' (not actually using) an existing language that's not a problem.

(It's more like Prolog I suppose, not syntactically but in declarativeness, which is also missing from your list. Unless it's lumped in with Lisp for having too many parens.)

Re:How Nix and NixOS get so close to perfect by mananaysiempre on Sunday April 24, 2022 @09:58AM (#31144040)
No particular problem with parens, hell if you want to do postfix I’m cool with that too, it’s just that the leading parens really discourage you from currying by default while ML-style juxtaposition-is-application does not (normally ML and F# curry a bit less, Haskell and Scala a bit more, but both curry much more than is usual in Common Lisp or Scheme). And currying is really useful when some of the curried functions are values of config settings.

I didn’t think HCL had laziness (which is vital to how NixOS module or Nixpkgs overlay A can set or use things in B which in turn set or use things in A), I’ll have to look at the theory more closely, thanks. (Its documentation tries pretty hard to make HCL look boring and weak, I guess it’s my fault for believing it.) Doing logic-programming-like things would probably also work as an approach to achieving these goals, yes, just a different one from that implied by my constraints above. I’d count CUE as being interesting in that direction as well even if it’s not technically logic programming (is it?.. the bibliography is not great). I’ll guess we’ll see.

Re:How Nix and NixOS get so close to perfect by rekado on Monday April 25, 2022 @04:35AM (#31151877)
> lazy (not Guix)

This is such a weird thing that keeps coming up. Why would the language have to be lazy? Obviously, there are tons of things that are lazily evaluated in Guix, e.g. the whole package graph. Why would Scheme have to be a lazy-by-default language? It baffles me that this objection keeps ending up on people's lists.

Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @08:17AM (#31143343)
>> Using Haskell as a base for the syntax

> I don’t really think this is a problem at all?

Of course it's a problem. You shouldn't use a syntax that has been soundly rejected by the industry.

Re:How Nix and NixOS get so close to perfect by mananaysiempre on Sunday April 24, 2022 @09:33AM (#31143823)
OK, fair enough, not an—independent? terminal?—problem: the syntax is largely forced upon us by the semantics, it’s not a Common Lisp vs Dylan or a Python vs Lua vs Ruby thing; and the semantics is the crux of the implementation approach (though not of the packaging organization being implemented).

If you want to argue against the semantics, by all means, but “industry doesn’t think it looks pretty” does not cut it, even “I don’t think it looks pretty” would afford more respect on my part (not least because the speaker is then able to explain what specifically they find off-putting or annoying, while “the industry” isn’t).

More details on syntax vs semantics in sibling comment[1].

[1] https://news.ycombinator.com/item?id=31143616

Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @10:16AM (#31144204)
> If you want to argue against the semantics, by all means, but “industry doesn’t think it looks pretty” does not cut it

I'm not arguing against semantics, and "the industry doesn't think it looks pretty" is not my argument either.

My argument is that, if you want the industry to accept something, it needs to be acceptable to the industry. Haskell-ish syntax[1] has clearly been unacceptable to the industry for a long time.

It's been rejected, again and again. At this point, it is pretty much guaranteed that attaching Haskell syntax to your new config format/language/application/whatever is a recipe for failure.

It's not that the industry just thinks it looks ugly, it's that the industry has outright rejected how it looks.

> even “I don’t think it looks pretty” would afford more respect on my part

My opinion on Haskell syntax, and whether or not you respect my opinion, is also pretty much irrelevant if the industry has already rejected it. I could be thinking that it's the best thing since sliced Jesus, but that won't change the fact that the syntax of Haskell has been rejected by the industry.

[1] Amongst others.

Re:How Nix and NixOS get so close to perfect by mananaysiempre on Sunday April 24, 2022 @10:50AM (#31144536)
My inner social psychologist, shameless amateur that he is, is not at all ready to pronounce the syntax to be the problem with nearly as much confidence as you do.

As far as I can tell, the only languages with Haskell-like syntax that have tried for serious industry adoption are Haskell, Scala, and perhaps Elm. (Idris is a borderline case, but it’s young and in any case I think we’re still a couple generations away from viable total languages.) Each of these has unconventional and similar semantics, different but complex type systems, and is trying for general applicability, while Nix has somewhat different semantics and no static type system at all, and is also trying to cover a very limited application area. Even Nix’s syntax, to my eye, is about as ML-like as it is Haskell-like.

How can we be so sure it’s the syntax, specifically, that is the problem? Are we controlling for these differences in any way at all?

It would be another matter if F# or OCaml or even Dylan was a runaway success while Haskell was not; while strict vs lazy is a hell of a difference I could be convinced that the syntax is the problem if people from the industry tried one after the other and consistently backed off in disgust, but that is not happening as far as I can tell.

I really don’t see how the verdict here could be anything but a definite “inconclusive”.

Finally, I’m also not seeing why I want industry acceptance. (I don’t think Xe’s post discusses it at all.) I want to use it, I want other users to discuss it with, I want it not to die a slow unmaintained death in five to ten years, but otherwise... Meh?

Advocating it to a single organization seems like a limited task (which I might fail), but advocating it to “the industry” seems like arguing with a force of nature (and I will fail). There would be some advantages to me if it were adopted, but then again it’s a first-generation system that has already accumulated substantial legacy cruft, so maybe I don’t want it to be adopted as it is now? Exploring the solution space? Definitely. Adoption at this particular stage? Not really sure, hard to get worked up about it.

P.S.

>> even “I don’t think it looks pretty” would afford more respect on my part

> My opinion on Haskell syntax, and whether or not you respect my opinion, is also pretty much irrelevant [...]

Wrong kind of “respect”, sorry: not how much I trust it, but how much concrete information I can expect to squeeze out of it (complete trust helpful, but neither necessary not sufficient). Opinions of large groups of people, even if reliably known, are notoriously hard to turn into actionable insights.

Re:How Nix and NixOS get so close to perfect by nix23 on Sunday April 24, 2022 @10:21AM (#31144249)
>has clearly been unacceptable to the industry for a long time.

What?? Galois, Facebook, IBM, Twitter, AT&T, Bank of America, Barclays Capital, NVIDIA, Microsoft and GitHub use Haskell.

https://wiki.haskell.org/Haskell_in_industry

Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @10:31AM (#31144351)
> What?? Galois, Facebook, IBM, Twitter, AT&T, Bank of America, Barclays Capital, NVIDIA, Microsoft and GitHub use Haskell.

So? The usage of Haskell within the entire industry is so small it's not even a rounding error.

It's hard to make the argument that the industry has accepted it when the industry usage is too tiny to even measure properly.

Re:How Nix and NixOS get so close to perfect by physPop on Sunday April 24, 2022 @12:02PM (#31145338)
Please define "the industry" and explain what credentials you have to know what "they" want.
Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @01:27PM (#31146162)
> Please define "the industry"

Programmers, and the work they do.

> and explain what credentials you have to know what "they" want.

It sounds ridiculous that you need "credentials" before you'd believe that Javascript, Python, Java or C# programmers, programs, projects and work doesn't each outnumber Haskell roughly 100 to 1.

Just about any metric you choose to use to evaluate what the industry uses, Haskell has so little usage that it's literally difficult to measure.

Job postings, TIOBE, RedMonk, SO survey, google-fight, you name it - Haskell is nowhere near rounding error percentages.

Maybe you should ask yourself why it doesn't show up in significant numbers on any metric rather than asking people what credentials they have.

Re:How Nix and NixOS get so close to perfect by rowanG077 on Sunday April 24, 2022 @09:16AM (#31143648)
Because industry makes good decisions? Decisions like adopting python, dooming a large part of the world software to be bug ridden slow messes. Or to elevate CUDA to the facto machine learning backend? Besides it's not clear that Haskell isn't adopted by industry due to the syntax.
Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @10:07AM (#31144132)
> Because industry makes good decisions?

That's irrelevant - if you want uptake, you need to support what user's want. It's been clear for at least a decade now that programmers don't want Haskell syntax.

Whether it's a good syntax or not is irrelevant.

Re:How Nix and NixOS get so close to perfect by rowanG077 on Sunday April 24, 2022 @10:12AM (#31144166)
Why do you think it's Haskells syntax that is the problem? The syntax is not so weird. I'd say the semantics are the hangup. 100% purity and lazy evaluation are a much harder pill to swallow then the syntax.
Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @10:39AM (#31144422)
> Why do you think it's Haskells syntax that is the problem? The syntax is not so weird. I'd say the semantics are the hangup. 100% purity and lazy evaluation are a much harder pill to swallow then the syntax.

Could very well be - either way the language has been rejected. Boasting of Haskell characteristics[1] is, IMO, a great way to turn off prospective users.

[1] I don't really know if the Nix project actually does blog posts and reachouts where they boast of Haskell-ish similarities.

Re:How Nix and NixOS get so close to perfect by rowanG077 on Sunday April 24, 2022 @12:27PM (#31145594)
I don't really see that industry has rejected Haskell at all. Haskell target simply wasn't (or isn't) industry. You can't really be rejected if you aren't trying to get into that niche. And Haskell has seen significant industrial use. So they succeeded at something they didn't even want to succeed at.
Re:How Nix and NixOS get so close to perfect by tiew9Vii on Sunday April 24, 2022 @11:50AM (#31145203)
> That's irrelevant - if you want uptake

Haskell's slogan is "avoid success at all costs". Haskell isn't aiming for mass adoption. It wants to be a language for researching functional programming, it just so happens it's a useful language, and people write real software with it too.

From https://haskell.foundation/whitepaper/ > Haskell's slogan of "avoid success at all costs" was a clever and cheeky way of saying that innovation and research in programming languages, especially in functional programming, needed some insulation to succeed

Nix doesn't have such a slogan as far as I know. It, however, started as a thesis to try and research and innovate new ideas. https://edolstra.github.io/pubs/phd-thesis.pdf The Purely Functional Software Deployment Model.

Twenty years later, it's been rather successful as a research project, one of the most active repos on GitHub. It has gained a lot of usage and support without trying to be successful, popular or market itself.

The Nix language has helped it achieve what it set out to achieve. It's appealing to people who are interested in purely functional software. If that doesn't appeal to Javascript / PHP devs that's ok as it isn't trying to appeal to them.

The Nix expression language is small and pretty simple; everything is an expression.

The difficult bit is there are no javadoc/jsdoc/pydoc type docs beyond https://nixos.org/manual/nix/stable/expressions/builtins.htm... where you can go search easily. You have to go through the source code to find functions and see how they work. Also, you have to accept Nix is a ML style language, not a C style language. It's different to what you may know, but that isn't a fault of the language if someone only knows C style languages. The language is as it needed to be like that to achieve the design it wanted. Personally, I hate using Ansible firstly because of YAML. Secondly, Ansible is a task runner, often feeling like you are over abusing Ansible for things that are not a natural fit, and the debug headache dealing with determinism by convention only.

I think it comes down to Nix isn't for you. That's ok.

Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @01:36PM (#31146242)
> Haskell's slogan is "avoid success at all costs". Haskell isn't aiming for mass adoption. It wants to be a language for researching functional programming, it just so happens it's a useful language, and people write real software with it too.

This isn't well-known - read through this thread - their are many people in this thread who deny that Haskell usage in industry is insignificantly small.

Re:How Nix and NixOS get so close to perfect by kaba0 on Sunday April 24, 2022 @05:24PM (#31148486)
Do note that it should be read as "avoid success at all costs" though, which changes the meaning quite a bit.
Re:How Nix and NixOS get so close to perfect by nix23 on Sunday April 24, 2022 @10:24AM (#31144277)
>if you want uptake, you need to support what user's want

Before the iPhone no one knew they wanted a good camera and "apps" on their phone.

See the important point here -> "knew they wanted"

Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @10:33AM (#31144371)
> >if you want uptake, you need to support what user's want

> Before the iPhone no one knew they wanted a good camera and "apps" on their phone.

> See the important point here -> "knew they wanted"

Haskell has been around now for something like 25 years. You'd have a point if the iPhone was unpopular for 25 years before users finally decided to like it.

It wasn't. Users saw the iPhone and wanted it the minute they saw it. Programmers have been looking at Haskell for 25 years and rejecting it.

Re:How Nix and NixOS get so close to perfect by physPop on Sunday April 24, 2022 @12:03PM (#31145368)
Say it with me: right tool for the right job. Not every language should try to solve every problem. And not every problem is nicely solvable in every language. By your definitions any language other than what, C and js is "unpopular" and "Rejected by the industry" ?
Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @01:36PM (#31146231)
> Say it with me: right tool for the right job. Not every language should try to solve every problem. And not every problem is nicely solvable in every language. By your definitions any language other than what, C and js is "unpopular" and "Rejected by the industry" ?

I literally claimed otherwise, elsethread

> It's a reflection of what the programmers want. Apparently they wanted syntax with braces and semicolons.

Javascript, C, C++, C#, Python and Java have seen and are still seeing heavy use in the industry. Go has gotten traction too, now.

Any language that can be seen on a common metric to be more than low single-digits (and, in some cases, fractions) of a percentage can be safely said to be "used in industry". I cannot think of any survey amongst programmers which shows Haskell usage outside of 1%-3%.

Re:How Nix and NixOS get so close to perfect by nix23 on Sunday April 24, 2022 @04:18PM (#31147908)
I have no idea why you think you speak for "the industry", you maybe live in a bubble but fortran, cobol and haskell are alive and well...remember, the right tool for the job.
Re:How Nix and NixOS get so close to perfect by nix23 on Sunday April 24, 2022 @11:01AM (#31144663)
>Programmers have been looking at Haskell for 25 years and rejecting it.

I really don't know why you think that true:

https://wiki.haskell.org/Haskell_in_industry

And i really don't know why you speak for "programmers", just speak for yourself...maybe?

Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @01:38PM (#31146260)
>> Programmers have been looking at Haskell for 25 years and rejecting it.

> I really don't know why you think that true:

Because it doesn't show up any any metric as having significant usage. A list of 100 companies using it doesn't make the hundreds of millions of other companies not using it go away.

Re:How Nix and NixOS get so close to perfect by nix23 on Sunday April 24, 2022 @04:22PM (#31147935)
Your argumentation is just completely wrong, you think that "significant usage" is some kind of "quality". You try to argue that a hammer and a screwdriver are of significant usage, when i fact the best tool for the job is a scalpel.

FWI HN was not written in JavaScript or PHP but you can lookup that for yourself.

Re:How Nix and NixOS get so close to perfect by lelanthran on Monday April 25, 2022 @07:10AM (#31152918)
> Your argumentation is just completely wrong, you think that "significant usage" is some kind of "quality".

Nowhere did I claim that - you're reading things I did not say.

Claiming that something is rejected by everyone does not make any statement on the quality of that thing.

[EDIT: It's kinda common knowledge that Haskell is barely used in industry. I cannot remember coming across a single non-academic programmer in the workplace who actually wanted to use it, other than myself]

Re:How Nix and NixOS get so close to perfect by nix23 on Monday April 25, 2022 @10:05AM (#31154933)
>rejected by everyone

It should be clear now, that this is a wrong statement.

Re:How Nix and NixOS get so close to perfect by lelanthran on Tuesday April 26, 2022 @04:34AM (#31165248)
>> rejected by everyone

> It should be clear now, that this is a wrong statement.

You're correct - it's rejected by roughly 999 out of every thousand programmers.

Re:How Nix and NixOS get so close to perfect by ge96 on Sunday April 24, 2022 @11:50AM (#31145204)
Heh, there's a project I'm trying to get into and it's written in Haskell, I gotta learn it... if possible I'm probably going to port it to something else.
Re:How Nix and NixOS get so close to perfect by tasuki on Sunday April 24, 2022 @10:15AM (#31144188)
> soundly rejected by the industry

That same industry which embraced PHP and JavaScript? Is that an authority, on what?

Also, the industry hasn't rejected Haskell, it has just been learning from it very slowly. My prediction is this trend will consistently continue at the same glacial speed.

Re:How Nix and NixOS get so close to perfect by lelanthran on Sunday April 24, 2022 @10:36AM (#31144399)
> That same industry which embraced PHP and JavaScript? Is that an authority, on what?

It's a reflection of what the programmers want. Apparently they wanted syntax with braces and semicolons.

Someone else pointed out elsethread that maybe it's not the syntax, but the semantics, that is being rejected here.

Re:How Nix and NixOS get so close to perfect by taktoa on Sunday April 24, 2022 @03:33PM (#31147463)
Nix syntax has braces and semicolons... the only similarity to haskell is in using juxtaposition for function application (though this is technically optional; nothing is stopping you from typing f(x))
Re:How Nix and NixOS get so close to perfect by deltaonefour on Sunday April 24, 2022 @11:33AM (#31145014)
If they picked javascript I'm sure nix would be more popular, but also despised by the same crowd that currently loves it.