!avYyleMexqjFHoqrME:nixos.org

Nix Documentation

404 Members
Discussion about documentation improvements around the Nix ecosystem78 Servers

Load older messages


SenderMessageTime
2 Dec 2023
@mao_tse-tung:matrix.orgmao_tse-tung joined the room.04:30:05
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @fricklerhandwerk:matrix.org

Things like at the top of this document: https://nixos.org/manual/nix/unstable/language/constructs/lookup-path

I don't want to call them grammar because we're still far away from actually formalising any of that

ah cool, so a little BNF like thing
04:33:51
@asymmetric:matrix.dapp.org.ukasymmetricthis is kinda neat https://landscape.nixlang.wiki/11:33:10
@bzzm3r:matrix.org@bzzm3r:matrix.org ran nix-shell in nixpkgs/docs/ a while....still compiling 🤣 23:13:54
@bzzm3r:matrix.org@bzzm3r:matrix.orgmy guess is that....oh, yeah23:14:05
@bzzm3r:matrix.org@bzzm3r:matrix.org i think i know why. i forgot to set npins up 23:14:23
@bzzm3r:matrix.org@bzzm3r:matrix.org No, I don't think that's it. The shell uses the parent nixpkgs repo as its nixpkgs...which causes my system to have to work quite hard, I suppose because build artifacts for master are not yet up on cachix? 🤔 23:33:59
@bzzm3r:matrix.org@bzzm3r:matrix.orgNot entirely clear on that point for now, but I have a workaround.23:34:38
3 Dec 2023
@bzzm3r:matrix.org@bzzm3r:matrix.orghttps://github.com/NixOS/nixpkgs/pull/27179701:12:09
@bzzm3r:matrix.org@bzzm3r:matrix.org(i'm not actually sure if it's useful, but...nothing lost, i suppose, in seeing if there is interest)02:39:12
@ThorHop:matrix.org@ThorHop:matrix.org changed their display name from hopland (valorent vicky) to hopland (meticulous montesquieu).14:08:33
4 Dec 2023
@ibizaman:matrix.orgibizaman joined the room.17:42:34
5 Dec 2023
@federicodschonborn:matrix.org@federicodschonborn:matrix.org changed their profile picture.00:38:12
@bzzm3r:matrix.org@bzzm3r:matrix.org hey docs team, i'm continuing to dig deep. currently just finished making my own mkShell implementation that isn't "bash focused" ([this SO answer]((per: https://stackoverflow.com/a/71112117/3486684)) partially gave me the hint, but also motivated by wanting to not use direnv) 05:15:44
@bzzm3r:matrix.org@bzzm3r:matrix.orgI've been collating various little fixes/clarifications to the stdenv chapter as i did this, so i'll probably PR them all for consideration too05:16:25
@bzzm3r:matrix.org@bzzm3r:matrix.org one question I am left with, ultimately, however is: why env vars? why do we end up storing stuff like builder, shellHook, *Phase as environment variables for shells? 05:17:04
@bzzm3r:matrix.org@bzzm3r:matrix.orgwhy not something less volatile/touchy? for example: files. files in the store? 05:17:48
@bzzm3r:matrix.org@bzzm3r:matrix.org * hey docs team, i'm continuing to dig deep. currently just finished making my own mkShell implementation that isn't "bash focused" (this SO answer partially gave me the hint, but also motivated by wanting to not use direnv) 05:25:09
@bzzm3r:matrix.org@bzzm3r:matrix.org

if we had a suitable "arithmetic" for "environment variable files", would we be able to replace env vars with such files? such an "arithmetic" i suppose would consist of operations like:

  • merging two environment variables: most of the times, this will be an 'override' operation depending on the "type" of the environment variable (much like what happens in attribute sets, heh...oh wait...
05:26:19
@bzzm3r:matrix.org@bzzm3r:matrix.org sorry, instead of files, why not store "environment variables" in a nix expression (which i guess is stored in a file) which produces an attribute set, whose attributes are the environment variables in a given attribute? 05:27:09
@bzzm3r:matrix.org@bzzm3r:matrix.org

okay, so with depending on the type of the environment variable (perhaps set by the user?) we'd have operations such as:

  • overriding (i.e. where envVarA * envVarB == envVarB)
  • concatenating (i.e. where envVarA * envVarB == envVarA + envVarB)
  • structural(?) merging, i.e. where envVarA * envVarB == { A = envVarA; B = envVarB }
  • list(?) merging, i.e. where envVarA * envVarB == [ envVarA envVarB ]

and these operations would help us "join" environments (attribute sets whose attributes are environment variables)?

05:33:31
@bzzm3r:matrix.org@bzzm3r:matrix.org *

okay, so with on the type of the environment variables (perhaps set by the user?) involved we'd have operations such as:

  • overriding (i.e. where envVarA * envVarB == envVarB)
  • concatenating (i.e. where envVarA * envVarB == envVarA + envVarB)
  • structural(?) merging, i.e. where envVarA * envVarB == { A = envVarA; B = envVarB }
  • list(?) merging, i.e. where envVarA * envVarB == [ envVarA envVarB ]

and these operations would help us "join" environments (attribute sets whose attributes are environment variables)?

05:33:57
@bzzm3r:matrix.org@bzzm3r:matrix.org *

okay, so with on the type of the environment variables (perhaps set by the user?) involved we'd have operations such as:

  • overriding (i.e. where envVarA * envVarB == envVarB)
  • string concatenation (i.e. where envVarA * envVarB == envVarA + envVarB)
  • attribute set union, i.e. where envVarA * envVarB == { A = envVarA; B = envVarB }
  • list concatenation, i.e. where envVarA * envVarB == [ envVarA envVarB ]

and these operations would help us "join" environments (attribute sets whose attributes are environment variables)?

05:35:33
@bzzm3r:matrix.org@bzzm3r:matrix.org *

okay, so with on the type of the environment variables (perhaps set by the user?) involved we'd have operations such as:

  • overriding (i.e. where envVarA * envVarB == envVarB)
  • string concatenation (i.e. where envVarA * envVarB == envVarA + envVarB)
  • attribute set union, i.e. where envVarA * envVarB == { A = envVarA; B = envVarB }
  • list concatenation, i.e. where envVarA * envVarB == [ envVarA envVarB ]

and these operations would help us "join" environments (attribute sets whose attributes are environment variables)?

I guess we'd also want similar parallels for other set-like operations: taking the differece, taking the intersection, etc. of "environments"

05:36:49
@bzzm3r:matrix.org@bzzm3r:matrix.org environment attribute sets could have a __functor = writeShellScript ... which allows conversion of the attribute sets into a source-able shell script which sets the environment variable of a shell? 05:38:52
@harsh-ps-2003-63ce2d0d6da0373984bd6022:gitter.im@harsh-ps-2003-63ce2d0d6da0373984bd6022:gitter.im left the room.06:51:41
@fricklerhandwerk:matrix.orgfricklerhandwerk

Welcome to the first year “Why?! And what if…“ deep dive!

Very briefly: historical reasons. Most of us weren’t around back then, but supposedly it was just the most straightforward way to do it. Stuff grew on top, and now it’s a system that’s hard to change without breaking lots of things.

There are discussions in the Nixpkgs Architecture Team about reworking stdenv, and Nix maintainers are talking on and off about which interfaces Nix itself should provide for that.

Generally: prototypes welcome! Just know that upstream tends to be quite conservative about such far-reaching changes because apart from requiring review they incur a maintenance cost someone has to be ready to carry, and that someone usually ends up being a very diverse group of people or no one at all. Therefore beyond just “but that’s obviously better” there is a coordination problem to be solved when it comes to changes to the core.

Here we’re more concerned with documenting what works, as it helps people to get things done right now. But it of course also exposes the warts more clearly and helps understanding what could be changed. Therefore, if you have any clarifications, please make small PRs with each of them. That makes it more likely to get each of them merged almost immediately, and those bits which need discussion (because often it’s not that simple) won’t block the ones that don’t.

09:21:22
@bzzm3r:matrix.org@bzzm3r:matrix.org
In reply to @fricklerhandwerk:matrix.org

Welcome to the first year “Why?! And what if…“ deep dive!

Very briefly: historical reasons. Most of us weren’t around back then, but supposedly it was just the most straightforward way to do it. Stuff grew on top, and now it’s a system that’s hard to change without breaking lots of things.

There are discussions in the Nixpkgs Architecture Team about reworking stdenv, and Nix maintainers are talking on and off about which interfaces Nix itself should provide for that.

Generally: prototypes welcome! Just know that upstream tends to be quite conservative about such far-reaching changes because apart from requiring review they incur a maintenance cost someone has to be ready to carry, and that someone usually ends up being a very diverse group of people or no one at all. Therefore beyond just “but that’s obviously better” there is a coordination problem to be solved when it comes to changes to the core.

Here we’re more concerned with documenting what works, as it helps people to get things done right now. But it of course also exposes the warts more clearly and helps understanding what could be changed. Therefore, if you have any clarifications, please make small PRs with each of them. That makes it more likely to get each of them merged almost immediately, and those bits which need discussion (because often it’s not that simple) won’t block the ones that don’t.

🤣 makes sense! So I'll take it as "my understanding is roughly correct", and to bring it back to documentation alone:

  1. I'll submit some small PRs to improve various small things around the parts of the stdenv docs I have just finished reading.

  2. Voicing out the above (and receiving some feedback on it) helps me make sure I'm not misunderstanding things to the point where the documentation changes are misguided.

  3. And I think I did have a misunderstanding. When I woke up today morning, I realized that: actually, stdenv does use attribute sets precisely to manage/merge environment variables.

Nix expressions don't transfer environment variables "raw" between themselves. Instead, the environment is captured within attribute sets (this is why extra attributes within the arguments passed between stdenv functions are eventually "realized" as environment variables).

Computations regarding what environment variables are ultimately needed during a derivation's build-time (or its run-time) happen with these attribute sets: for example, this is what mkShell does), while functions such as shellHook serve the role of the "functor" I was imagining: they convert these attribute sets into environment variables.

15:08:24
@bzzm3r:matrix.org@bzzm3r:matrix.org This might be worth putting into the docs in one or two lines? My brain was roughly getting this message, but I didn't fully "realize" it until I had some sleep, and I think (if I am correct, I might still not be) that it might be a useful way to understand what all the mechanisms in stdenv around dependencies are ultimately doing. 15:11:17
@bzzm3r:matrix.org@bzzm3r:matrix.org (It has, for me at least, been very helpful in understanding what mkShell does, so that I can write my own derivation that is less bash-focused, as Rob suggests in the SO answer I linked before: https://stackoverflow.com/questions/71016402/how-to-start-a-zsh-shell-session-with-additional-non-permanent-aliases/71112117#71112117) 15:13:16

Show newer messages


Back to Room ListRoom Version: 6