Sender | Message | Time |
---|---|---|
5 Sep 2024 | ||
@hiwhatname:matrix.org removed their profile picture. | 17:20:24 | |
@hiwhatname:matrix.org removed their display name Deleted. | 17:21:42 | |
@hiwhatname:matrix.org left the room. | 17:21:52 | |
@aruzeta:matrix.org left the room. | 18:12:22 | |
djacu joined the room. | 19:32:42 | |
@eya:catgirl.cloud left the room. | 22:38:59 | |
6 Sep 2024 | ||
Thom Jordan joined the room. | 18:17:24 | |
Kimberly McCarty joined the room. | 23:22:24 | |
7 Sep 2024 | ||
lunik1 changed their profile picture. | 01:45:32 | |
Leonardo Santiago joined the room. | 02:15:50 | |
Sami Liedes joined the room. | 03:27:48 | |
Kotz left the room. | 08:09:38 | |
Kotz joined the room. | 08:10:07 | |
throwachimera | Hi, I'm trying to learn Nix for NixOS and sometimes I want to evaluate expressions to understand them better. However, when I try using libraries from nixpkgs, they don't fully evaluate. For example:
I'm not sure if this is due to lazy evaluation or if there’s some other reason. How can I work around this? In general, I'd be interested in hearing about the ways people here debug and learn the language, as I guess I'm not usually seeing the resulting attribute sets directly when using it to configure NixOS. | 11:23:17 |
Nicolas Lenz | In reply to @throwachimera:matrix.org This isn't actually something directly related to the language or evaluation, I think. The result in your example actually is fully evaluated! The mkIf funtion in nixpkgs is just defined in a way that evaluates to that attribute set. The NixOS module system would tzen take that result if you put that in your config and use it to calculate yout final config. That is implemented in Nix, but not a feature of the Nix language itself. The Nix language has no concept of modules and so on, so NixOS uses things like Nix attribute sets with _type attribute as in your example to implement its features. | 11:31:31 |
emily | yeah, I think the missing piece here is that the NixOS module system is functionality implemented entirely within the Nix language | 11:34:22 |
emily | not a language feature | 11:34:25 |
emily | you'll have to call into the Nixpkgs library functions that resolve definitions, evaluate module configs, etc. | 11:34:44 |
throwachimera | In reply to@eisfunke:eisfunke.comOkay I see, I guess it makes sense. I'll dive a bit into the module system, thanks for the pointers! | 11:39:05 |
emily | the Nixpkgs manual has some documentation on it | 11:42:45 |
emily | and you can read lib/options.nix and lib/types.nix (but beware of dragons) | 11:42:57 |
infinisil | throwachimera: Here's something that works:
| 11:50:33 |
infinisil | Or since
| 11:52:09 |
throwachimera | In reply to@infinisil:matrix.orgAyy that's cool, thanks a lot :)! Man I still have such a long way to go, nix can be confusing 😅 | 11:54:08 |
infinisil | Glad to help :) | 11:54:28 |
infinisil | I'd say the Nix language is actually fairly simple. It's Nixpkgs that's so damn messy 😆 | 11:54:56 |
infinisil | Btw for more module system specific questions, there's also #modules:nixos.org | 11:55:47 |
@nakibrayan5:matrix.org removed their profile picture. | 12:22:08 | |
@nakibrayan5:matrix.org removed their display name ريان نقيب. | 12:22:14 | |
@nakibrayan5:matrix.org left the room. | 12:22:21 |