Which is worse hell to write?

Evaluate on criteria such as lack of usable documentation, code ugliness, ease of determining what is wrong when something won't work, and generally the amount of headaches you experience trying to get something to work

#rust #rustlang #nix #nixlang #nixos

Nixlang
30.2%
Unsafe Rust
20.9%
I only know one of these languages / I know neither language / I only use safe Rust / show results
48.8%
Poll ended at .
@AVincentInSpace
Nix is just like JSON but with functions🤔. That's all to think about it. Nothing more. #Nix as a language is that simple. Nix as a ecosystem maybe hard to grasp at first. But definitely not the language itself, even the ecosystem developed an abstracted collection of functions for users to do things easier.
https://noogle.dev
Noogle - Simply find Nix API reference documentation.

Nix API reference. Includes nix, nixpkgs and nixos. Search nix functions within the nix ecosystem based on type, name, description, example, category and more.

@vivekanandanks @AVincentInSpace what about debugging nix ?

I find the developer experience to be a pain

@blueluma
The debug mostly comes people's different use cases, so in that part I wish there are more nix educational contents which makes things easier for the ecosystem. Maybe I should start doing educational contents about Nix.
@vivekanandanks Nix error message are on of the worst thing I've ever seen, next to LaTeX error messages
@blueluma
I have to agree on this. But things are getting better in the ecosystem. So things will get better.

@vivekanandanks well yeah, nix is a simple language, once you get past the syntax (destructuring an attrset as a function argument has names delimited by commas (trailing comma optional), attrset literals have key-value pairs delimited by semicolons (trailing semicolon mandatory), items in array literals are delimited by WHITESPACE, functions and their arguments are also separated by whitespace so if you want to put a function call in a list you have to parenthesize it, and destructuring an array as a function argument is JK LMFAO THERE'S NO WAY TO DO THAT you have to do (builtins.elemAt list 0) (builtins.elemAt list 1) like a FOOL)

(oh and functions can't take multiple arguments. the two ways to pretend they can are to take an attrset as an argument which you then destructure or make a function that takes the first argument that then returns another function that takes the second argument. and we still have to talk about rec and let and with and inherit. but apart from that just like JSON with functions!)

@vivekanandanks and that's before you even start to get into the incredibly poorly documented nixpkgs ecosystem and what nix is actually for, which is getting software to compile.

i gotta say, nix produces some of the worst error messages i have ever seen from an interpreter. traceback lengths that put java's to shame, no easy way to find your own code except to look for paths not in the nix store (unless you're trying to build a flake in which case your own code is in the nix store and suffixed with -source, just like nixpkgs itself and every github repo your project pulled, so good fuckin luck m8) but then even when nix executes successfully and figures out what it's supposed to do, when gradle complains about $JAVA_HOME not being set, where do you go to fix that? or when npm complains about not being able to download a dependency that node2nix didn't grab, how do you fix that? or when a crate2nix project complains it can't find a C compiler and you have to look up how to do crate overriddes to give it one

@vivekanandanks OH and i almost forgot to mention that because nix has a derpecated feature where it doesn't require quotes around URLs, `a: a` evaluates as a lambda but `a:a` evaluates as a string

why couldn't they have just used a real programming language like guix did

@AVincentInSpace
I think I just triggered someone too much by saying nix is easy 🥹. Can't argue with you. Coz what u said is sadly true for nix as a ecosystem.

@vivekanandanks

> i just triggered you by saying nix is easy
> can't argue with you though. it's not easy

i do generally respond pretty badly to lies, yes

@AVincentInSpace
I could say "it's not a lie" . But I think it's better I help the ecosystem in general to breakdown stuffs into easy learnings for newcomers.
Ur roasting level is 10000000% 🥲🥲🥹🥹

@vivekanandanks @AVincentInSpace if you have time, please have a look at this github issue :)

https://github.com/kpcyrd/what-the-src/issues/12#issuecomment-2132435470

I had the attention of quite a few Nix people, but nobody could help me with "how do I get the urls nixpkgs is using", as this requires partial execution of expressions in a way I'm not sure is supported.

NixOS support · Issue #12 · kpcyrd/what-the-src

It would be cool to import data from github.com/NixOS/nixpkgs. I'm not sure what's the best way to get the relevant data. I know i can do nix-instantiate --eval --json --strict -E 'with (import <ni...

GitHub

@kpcyrd
Hi
I saw the project.

1) Some understanding of mine in it below. Correct me if I'm wrong.
The project is to show which exact source revision of a package is used by various package managers/repos right? (along with the sha256 hash)

2) Also curious what's the use case of this project?🤔 For knowing which package every distro use in a single place?

@kpcyrd @vivekanandanks @AVincentInSpace Not sure of the current state of the project but the best bet is likely to re-use the JSON file generated by https://github.com/nix-community/nixpkgs-swh cc @lewo
GitHub - nix-community/nixpkgs-swh: Send nixpkgs tarballs to Software Heritage [maintainer=@nlewo]

Send nixpkgs tarballs to Software Heritage [maintainer=@nlewo] - nix-community/nixpkgs-swh

GitHub

@Le_suisse @kpcyrd @vivekanandanks @AVincentInSpace

In the file generated by the nixpkgs-swh project (https://nixpkgs-swh.nixos.org/sources-unstable.json), there is not a binding between the name of a package and its source code.

I'm not sure the what-the-src concept could be easily applied to nixpkgs. A nixpkgs "package" contains a graph of sources and it could be hard to know which source in this graph is the actual source of the package.

@Le_suisse @kpcyrd @vivekanandanks @AVincentInSpace

However, you could try to infer the package name from the narinfo attribute exposed in the https://nixpkgs-swh.nixos.org/sources-unstable.json file, but this could easily lead to mistakes...

@lewo Yes, I too felt that. Nix is a source repo model. Also with overrides and overlays I think the hash on the local will be definitely different. But if what-the-src's point is to just show what version is being used in other package managers I think it'll be great probably hash not needed in nixpkgs concept. But all binary repo models needs this hash I guess like maybe to see if they are in a particular patched version or something.