!djTaTBQyWEPRQxrPTb:nixos.org

Nixpkgs Architecture Team

220 Members
https://github.com/nixpkgs-architecture, weekly public meetings on Wednesday 15:00-16:00 UTC at https://meet.jit.si/nixpkgs-architecture52 Servers

Load older messages


SenderMessageTime
14 Mar 2024
@infinisil:matrix.orginfinisilrelevant comment and reply: https://github.com/NixOS/nixpkgs/pull/293835#pullrequestreview-192993701219:38:37
@philiptaron:matrix.orgPhilip Taron (UTC-8) This was the first PR I made against lib, so the historical reason is that I was trying to do the work by hand and I didn't have the script I later wrote to gather and use the names automatically. 19:39:05
@infinisil:matrix.orginfinisilHaha I see19:39:35
@philiptaron:matrix.orgPhilip Taron (UTC-8) I've formed a small bias towards the shortest path. So if a name is re-exported from lib, I'll use that. 19:39:58
@philiptaron:matrix.orgPhilip Taron (UTC-8) * Since I opened the PR, I've formed a small bias towards the shortest path. So if a name is re-exported from lib, I'll use that. 19:40:11
@infinisil:matrix.orginfinisil Philip Taron (UTC-8): Sounds good to me 19:42:32
@philiptaron:matrix.orgPhilip Taron (UTC-8) I still have Robert's feedback (and now yours) to go and digest in the lib/trivial.nix PR. 19:42:47
@philiptaron:matrix.orgPhilip Taron (UTC-8) Note that that PR, unlike the rest, isn't about with removal -- it was mostly formed because of my trying to make sense of how lib is structured, so getting on the same page with you and robert about it is key for my future contributions in the area. 19:43:50
@philiptaron:matrix.orgPhilip Taron (UTC-8)But I can keep gathering that knowledge about it on a low simmer instead of a strong boil; digesting approaches takes time.19:45:20
@infinisil:matrix.orginfinisilHaha great way to word it19:46:35
@philiptaron:matrix.orgPhilip Taron (UTC-8)

I do have a couple of conclusions after reading through most of lib/:

  1. lib.or was mostly a mistake. Having a token that's part of the Nix grammar also be an identifier is really ambiguous. lib.and has the same problem.
  2. Having an explicit list of symbols to export definitely reduces the chance of exporting a helper function that isn't used outside of lib. For instance, lib.systems.parse exports gnuNetBSDDefaultExecFormat, and I bet it didn't mean to.
  3. let ... in blocks are great.
  4. Whether to use lib or builtins is made substantially harder by lib not being a drop-in for builtins.
19:54:22
@infinisil:matrix.orginfinisil

Philip Taron (UTC-8):

  1. Oh damn didn't realise that, though I never used or nor do I see a good use case for it. I think lib.and should be fine, since there's no and keyword
  2. +1
  3. +1
  4. Yeah.. I think this should be fixed, though I guess some builtins might not make sense in lib, like builtins.import or builtins.fetchGit (or does it?)
19:58:30
@philiptaron:matrix.orgPhilip Taron (UTC-8) There's no and keyword? There's an and token and a production that uses it... 19:59:57
@infinisil:matrix.orginfinisil Philip Taron (UTC-8): That's && :P 20:00:28
@philiptaron:matrix.orgPhilip Taron (UTC-8)
In reply to @infinisil:matrix.org
Philip Taron (UTC-8): That's && :P
🤦
20:00:48
@infinisil:matrix.orginfinisil Philip Taron (UTC-8): https://github.com/NixOS/nix/blob/master/src/libexpr/lexer.l#L124 20:00:49
@infinisil:matrix.orginfinisil * Philip Taron (UTC-8): https://github.com/NixOS/nix/blob/c152c2767a262b772c912287e1c2d85173b4781c/src/libexpr/lexer.l#L124 20:01:02
@philiptaron:matrix.orgPhilip Taron (UTC-8)I, uh, should have read the lexer on the matter. Oops.20:01:58
@philiptaron:matrix.orgPhilip Taron (UTC-8) *

I do have a couple of conclusions after reading through most of lib/:

  1. lib.or was mostly a mistake. Having a token that's part of the Nix grammar also be an identifier is really ambiguous. ~lib.and has the same problem.~
  2. Having an explicit list of symbols to export definitely reduces the chance of exporting a helper function that isn't used outside of lib. For instance, lib.systems.parse exports gnuNetBSDDefaultExecFormat, and I bet it didn't mean to.
  3. let ... in blocks are great.
  4. Whether to use lib or builtins is made substantially harder by lib not being a drop-in for builtins.
20:03:28
@philiptaron:matrix.orgPhilip Taron (UTC-8) *

I do have a couple of conclusions after reading through most of lib/:

  1. lib.or was mostly a mistake. Having a token that's part of the Nix grammar also be an identifier is really ambiguous. lib.and has the same problem.
  2. Having an explicit list of symbols to export definitely reduces the chance of exporting a helper function that isn't used outside of lib. For instance, lib.systems.parse exports gnuNetBSDDefaultExecFormat, and I bet it didn't mean to.
  3. let ... in blocks are great.
  4. Whether to use lib or builtins is made substantially harder by lib not being a drop-in for builtins.
20:03:42
@ma27:nicht-so.sexyma27 btw what's the recommended approach to keeping the inherit (lib.X) things up-to-date when actively writing code?
Doing that manually (and remembering whether it's called strings, string or str for instance) feels pretty cumbersome which is why I'm still falling back to with lib; quite often.
20:39:16
@philiptaron:matrix.orgPhilip Taron (UTC-8)
In reply to @philiptaron:matrix.org
Since I opened the PR, I've formed a small bias towards the shortest path. So if a name is re-exported from lib, I'll use that.

@ma27: figuring out which submodule to pull from -- and keeping them straight -- is one reason I end up favoring inherit (lib) name. Even with the with lib;, you still needed to know what name was, so the answer is pretty straightforward, I think:

  1. Put inherit (lib) name at the same place you'd land with lib;
  2. Use name normally.
20:48:25
@philiptaron:matrix.orgPhilip Taron (UTC-8)
In reply to @philiptaron:matrix.org
Since I opened the PR, I've formed a small bias towards the shortest path. So if a name is re-exported from lib, I'll use that.
*

ma27: figuring out which submodule to pull from -- and keeping them straight -- is one reason I end up favoring inherit (lib) name. Even with the with lib;, you still needed to know what name was, so the answer is pretty straightforward, I think:

  1. Put inherit (lib) name at the same place you'd land with lib;
  2. Use name normally.
20:48:41
@philiptaron:matrix.orgPhilip Taron (UTC-8) On lib.or: as far as I can tell, it's used in three files (lib/options.nix, pkgs/build-support/writers/data.nix, and pkgs/build-support/writers/scripts.nix) and for the uses in writers it could be trivially replaced with ||. 21:06:46
@philiptaron:matrix.orgPhilip Taron (UTC-8)
In reply to @philiptaron:matrix.org
On lib.or: as far as I can tell, it's used in three files (lib/options.nix, pkgs/build-support/writers/data.nix, and pkgs/build-support/writers/scripts.nix) and for the uses in writers it could be trivially replaced with ||.
https://github.com/NixOS/nixpkgs/pull/295982
21:14:29
15 Mar 2024
@quantenzitrone:matrix.org@quantenzitrone:matrix.org changed their display name from quazi [ˈkvaːzi] to Zitrone.12:05:44
@ryantm:matrix.orgryantm infinisil: I'm running into an issue where I want to add new top-level attributes for my mmdoc rendering of the nixpkgs manual, and it depends on nixpkgs/doc folder, so when I put it in pkgs/by-name/ it complains about me using ../../ etc to reference the doc folder, and if I don't use by-name it also complains. Is there a way to skip the by-name checks one way or the other? Maybe I could fake inherit something in all-packages.nix to trick it, but that seems dirty. 19:22:53
@ryantm:matrix.orgryantmMoving the whole doc folder into pkgs/by-name feels wrong too :devil:19:23:46
@infinisil:matrix.orginfinisil ryantm: Ah that's an interesting case.. 19:23:50
@infinisil:matrix.orginfinisil🤔19:23:53

Show newer messages


Back to Room ListRoom Version: 9