Live data from Hacker News

Nix Language Primer

binaryphile.com

31–40 of 69 posts

Re: Nix Language Primer

#31

Earlier quoted context omitted.

Huh. I think this is the first bad experience with NIX I've ever heard on HN. Having only ever heard about it in passing but never worked with it myself I'm curious, what were you building when you'd encountered it and what issues did you have. Was there a particular language you'd preferred to have worked in?

> Huh. I think this is the first bad experience with NIX I've ever heard on HN. Strictly speaking "Nix" may refer to two things, and I'm not sure which thing either of you are referring to, nor if you two are referring to the same thing. Personally I found the nix package-manager a bit odd, but to me that was not a deal-breaker for trying out NixOS. The bigeset problem for me was lacking packages... I was however wil…

> In the long run, I really hope Guix manages to get something good going. My biggest concern for Guix is that they will restrict the available packages by being overly zealous about package-licensing (like everything the FSF does).

Guix co-maintainer here. The Guix project is not run by the FSF; it is part of the GNU project, because we subscribe to the idea of giving users the tools to take control of their computing.

Packages available through the official Guix channel must be compliant with the Free System Distribution Guidelines:

    https://www.gnu.org/distros/free-system-distribution-guidelines.html
The large package collection that comes with Guix is trivially extended through channels: a git repository containing Guix modules defining extra packages. You can do without git and just add a local directory of modules to GUIX_PACKAGE_PATH.

At the institute where I work we're using channels to provide packages that are not available in Guix proper. It's very simple.

Re: Nix Language Primer

#32
post #24
post #20

Earlier quoted context omitted.

Why would anyone use it versus its competitors? Here's why: 1. You can uninstall a thing and it will no longer affect your computer. 2. Your environment will work the same way on your colleague's computer. 3. Your environment will work the same way years down the line. 4. Your environment will probably work the same way years down the line, even after you've applied security updates. If it doesn't, it will probably b…

I don't care about those features, I just wanted to download the packages and it's dependencies and in the end it never did that. Nix is probably good for many things, but it's not simple and to me it's trying to do too many things.

The reason you can "download a package and its dependencies" with other package management systems, is not because they are technically superior, but because they've had countless man-hours of contributors making sure that their central repository contains packages which work well together.

As soon as any assumption changes, like for example, adding a third-party application repository, then you need to concern yourself with all of the issues mentioned above, or you'll end up wasting your days on manually building and installing packages locally.

The point of Nix is to do this once only. If you build and it runs, it should do the same for everyone, regardless of what other repositories they use. Package management becomes completely modular and does not depend on some centralized state like a central software repository, or the state of your machine at time of install.

Nix isn't trying to do too many things. It's actually much, much simpler than using a bunch of semi-compatible tools which all attempt to do similar things in ad-hoc ways. Nix is just a dependency management system where dependencies are specified by their content hash. Your machine contains a content-addressable store of objects which can be precisely referenced by any other object. It takes the guesswork out of dependency management. Other dependency managers effectively run a search engine to try and find an appropriate dependency from some search terms.

Re: Nix Language Primer

#33
post #2

Does anyone know the rationale for creating Nixlang? Guix's use of Scheme proves there isn't a novel feature unavailable elsewhere, so it seems like a lot of wasted effort to implement a language that will likely only ever be used for one suite of programs. (And tooling; though almost none exists now, making the choice even more expensive.) I've tried to find one, but "nix" is a difficult thing to google for given th…

Nobody wants an arbitrary complex program for describing some trivial build steps. A programming language here is an anti-feature.

Ideal would be some DSL that isn't even Turing complete, but that's not practical at the moment. Maybe we'll get there some day.

Re: Nix Language Primer

#34
post #2

Does anyone know the rationale for creating Nixlang? Guix's use of Scheme proves there isn't a novel feature unavailable elsewhere, so it seems like a lot of wasted effort to implement a language that will likely only ever be used for one suite of programs. (And tooling; though almost none exists now, making the choice even more expensive.) I've tried to find one, but "nix" is a difficult thing to google for given th…

Nobody wants an arbitrary complex program for describing some trivial build steps. A programming language here is an anti-feature. Ideal would be some DSL that isn't even Turing complete, but that's not practical at the moment. Maybe we'll get there some day.

Dhall and Dhall-nix are definitely a step towards that.

Re: Nix Language Primer

#35
post #2

Does anyone know the rationale for creating Nixlang? Guix's use of Scheme proves there isn't a novel feature unavailable elsewhere, so it seems like a lot of wasted effort to implement a language that will likely only ever be used for one suite of programs. (And tooling; though almost none exists now, making the choice even more expensive.) I've tried to find one, but "nix" is a difficult thing to google for given th…

Nobody wants an arbitrary complex program for describing some trivial build steps. A programming language here is an anti-feature. Ideal would be some DSL that isn't even Turing complete, but that's not practical at the moment. Maybe we'll get there some day.

It's difficult to not be Turing complete.

Makefiles are Turing complete: https://nullprogram.com/blog/2016/04/30/

Re: Nix Language Primer

#36
post #28
post #19

Earlier quoted context omitted.

For me personally, as a person who's tried Nix, it's helpful that the Nix language is simple, self contained and easy to learn & grok quickly. I never learnt Scheme, and its use in Guix, though extremely interesting and appealing in theory, also feels notably overwhelming to me. That I'd have to learn a whole (presumably huge) R7RS or something, just to be able to use Guix. And then still have to learn the Guix "API"…

Disclaimer: as a Guix co-maintainer I'm totally biased. We don't use R7RS in Guix. You need to know about the Scheme syntax, obviously (including keyword arguments), and a couple of common procedures like `string-append`, but aside from that you don't really need to know much about Scheme at all. What comes in handy is the Guix DSL, which provides a convenient way to specify packages and download origins. Guix also h…

Does Guix let you write interactive programs in Scheme as part of the system configuration? For example, defining a systemd service that uses Guile libraries and so on, as a subexpression of your OS configuration file? While also referring to shared variables like the system's hostname, etc?

I skimmed the paper on "Code Staging in Guix" and I think this should be very doable, but I haven't yet tried Guix for real.

This ability seems like it would have huge implications for system development... I've dabbled with such experiments using Nix, but the lack of hygienic code staging makes it a bit icky.

Re: Nix Language Primer

#37
post #2

Does anyone know the rationale for creating Nixlang? Guix's use of Scheme proves there isn't a novel feature unavailable elsewhere, so it seems like a lot of wasted effort to implement a language that will likely only ever be used for one suite of programs. (And tooling; though almost none exists now, making the choice even more expensive.) I've tried to find one, but "nix" is a difficult thing to google for given th…

Do yourself a favor and watch Gabriel Gonzalez's talk "Nix: Under the Hood" ( https://youtu.be/GMQPzv3Sx58 ).

Re: Nix Language Primer

#38
post #31

Earlier quoted context omitted.

> Huh. I think this is the first bad experience with NIX I've ever heard on HN. Strictly speaking "Nix" may refer to two things, and I'm not sure which thing either of you are referring to, nor if you two are referring to the same thing. Personally I found the nix package-manager a bit odd, but to me that was not a deal-breaker for trying out NixOS. The bigeset problem for me was lacking packages... I was however wil…

> In the long run, I really hope Guix manages to get something good going. My biggest concern for Guix is that they will restrict the available packages by being overly zealous about package-licensing (like everything the FSF does). Guix co-maintainer here. The Guix project is not run by the FSF; it is part of the GNU project, because we subscribe to the idea of giving users the tools to take control of their computi…

I recently posted on HN complaining about Nix and Guix.

For myself (and I suspect many people) when installing GuixSD, before I even have the system running, I'm going to need to figure out how to package the Linux kernel with firmware for my wifi. Otherwise my ~$3k laptop is basically a brick. That is a big ask right up front. Glancing at the mailing list it seems like discussing non-free software is discouraged. Even if there is some well maintained Linux package on Github it would be difficult to find and evaluate before having any experience with Guix.

It is your project and you can obviously have whatever rules you want. It just seems that Guix and Nix made some odd choices that are going to keep both projects in a very small niche.

Re: Nix Language Primer

#39
post #14

There is also https://jsonnet.org/

Yep they're pretty similar in goals, (and syntax?) except for that nix has built in support for derivations as a language feature. Nix is a language for derivations first a language for configurations second. Jsonnet is only a configuration language.
Post reply on HN