The name Nix is used for the language, package system, and sometimes the whole ecosystem. There is a recent post that tells the difference https://www.haskellforall.com/2022/08/stop-calling-everythin... Knowing functional programming helps but Nix still is a hard language to learn. I have a lot of Haskell experience but the Nix language was very confusing for me. At first I couldn't even tell a variable name from a k…
We want to make Nix better
181–190 of 204 posts
Re: We want to make Nix better
#182Earlier quoted context omitted.
> This is why Nix is really just a front for bash. For all of its faults, at least bash is Turing-complete. Nix is Turing-complete. This was even sometimes considered a problem because it makes the language too powerful: https://nixos.org/~eelco/talks/guix-feb-2018.pdf
This is news to me, I admit. But if this is true, then people shouldn't say Nix is declarative.
What makes it declarative is the lack of side effects and laziness.
Re: We want to make Nix better
#183Earlier quoted context omitted.
Just tried it, it does work. Not in the `--help` though.
This subthread is exactly why NixOS is getting much traction outside of enthusiasts and people with a lot of patience.
I think the idea that Nix is difficult to get started with, and undocumented, isn't a surprise to the community. -- These were some of the most repeated points in the community survey. And the topic of the submitted post.
That said, I do think Nix has seen a lot of growth over the last year, and I see fewer "nix is so easy" comments.
Re: We want to make Nix better
#184Is it Nix or NixOS?
NixOS is a bootable OS build on top of Nix.
Nixpkgs is the default package collection used by both Nix and NixOS.
Re: We want to make Nix better
#185Just let me a pin a single package to a version number, for the love of God.
pkgs.yourpackage.overrideAttrs { prev: {
src = fetchurl {
url = "...";
sha256 = "...";
};
}}
Bit annoying that you have to specific the full URL instead of just the 'version' number, but it'll work.With flakes you can just add a 'ref' or 'rev' to the URL:
nix run "github:juser/software?ref=v0.4.1"
If you want to override a package dependency across 'override'.Re: We want to make Nix better
#186Just let me a pin a single package to a version number, for the love of God.
Re: We want to make Nix better
#187Earlier quoted context omitted.
I might suggest making a typed superset of Nix, basically adding record types and function signatures. That in itself would be a huge boon for tooling and interacting with nixpkgs. nixpkgs describes a huge and varied meta-API for derivations in various build ecosystems, which makes it hard to use because you ultimately need to dive into source code.
Some community members have looked into this quite a bit, and personally I have come to the conclusion that types don't really give that much benefit to Nix (and I say this as a Rust & Haskell developer). Nix expressions are almost always[2] short-lived snippets that evaluate to a data structure, not long-running programs where the distinction between "static analysis time" and runtime is extremely relevant. In fact,…
Re: We want to make Nix better
#188Earlier quoted context omitted.
> To seriously answer the question: is the Nix language required for the Nix packaging system to exist? Laziness is required, to some degree, but can the next iteration provide an on-ramp which doesn't involve learning a new lang and paradigm? Guix folks sure think so. I'd love to hear from someone deeply familiar with Nix and Guix about laziness. I'm deeply familiar with Nix and I've concluded that lazy semantics is…
> I don't need to topologically sort the evaluation of the various inter-dependencies of my configuration. So long as there exists an evaluation order, laziness finds it. That’s not a property of laziness but of how Nix evaluates configurations. I think people overvalue what laziness brings them because they attribute to it things which could be done equally well with an eager language.
Being able to write
let usercfg = { username = "nix-user";
homedir = "/home/" + usercfg.username;
};
in usercfg
is nearly a hallmark of non-strict semantics, which is achieved by lazy evaluation.Strict languages can simulate these non-strict semantics by using functions of no parameters to delay evaluation, but you lose the efficiency that comes from the memoization of record fields that you get with lazy evaluation.
P.S. The above would perhaps be more likely be written as
rec { username = "nix-user"; homedir = "/home/" + username; }
but when specifying larger configurations composed of multiple nested records with wide cross-cutting inter-dependencies, "rec" doesn't really cut it as "rec" works best with extremely local inter-dependencies.Re: We want to make Nix better
#189Earlier quoted context omitted.
What nix needs more than anything is a centralized repository containing recipes for running all the different kinds of programs, as nic files. ie a dockerhub alternative.
nixpkgs?
nix flake show templates
But the examples in there are a bit out of date and don't necessarily reflect real world usage and are lacking in comments (e.g. still using defaultPackage, not using flake-utils, etc.).Re: We want to make Nix better
#190Earlier quoted context omitted.
This subthread is exactly why NixOS is getting much traction outside of enthusiasts and people with a lot of patience.
Missing a 'not', I think? I think the idea that Nix is difficult to get started with, and undocumented, isn't a surprise to the community. -- These were some of the most repeated points in the community survey. And the topic of the submitted post. That said, I do think Nix has seen a lot of growth over the last year, and I see fewer "nix is so easy" comments.