!djTaTBQyWEPRQxrPTb:nixos.org

Nixpkgs Architecture Team

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

Load older messages


SenderMessageTime
14 Mar 2024
@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
@infinisil:matrix.orginfinisil ryantm: I'd say, don't put it in all-packages.nix, how about doc/default.nix instead, then optionally alias it from all-packages.nix 19:24:40
@ryantm:matrix.orgryantmI'd like to make it be a normal nixpkgs pkg.21:32:46
@ryantm:matrix.orgryantmI've committed terrible crimes and got it to pass checks https://github.com/NixOS/nixpkgs/pull/108063/files#diff-ab5748dc9567516fefba8344056b51ec1866adeace380f46e58a7af3d619ea22R4019621:44:59
@ryantm:matrix.orgryantm infinisil: What does "alias it from all-packages.nix" mean? 22:59:01
@infinisil:matrix.orginfinisil ryantm: Hmm so nixpkgs is a mess. I was hoping that the doc/default.nix attributes were somehow accessible in the top-level attribute set, but they're not 23:09:21
@infinisil:matrix.orginfinisilSome restructuring might be in order to make that a possibility23:09:33
@infinisil:matrix.orginfinisil At least currently the manual can be built using nix-build doc or nix-build pkgs/top-level/release.nix -A manual 23:10:30
@infinisil:matrix.orginfinisil(and probably some other ways)23:10:37
@ryantm:matrix.orgryantmI kind of think it would be good to add some magic comments that bypass nix by-path checks. If these magic comments are unique enough, we can grep for them later.23:10:50
@ryantm:matrix.orgryantm Maybe I can trick them by doing something like thing = callPackage ./path/to/package/ { inherit stdenvNoCC;} 23:12:01
@infinisil:matrix.orginfinisilWouldn't work, it's too smart for that :P23:12:54

Show newer messages


Back to Room ListRoom Version: 9