!djTaTBQyWEPRQxrPTb:nixos.org

Nixpkgs Architecture Team

233 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
23 Jul 2022
@profpatsch:augsburg.oneprofpatschIf by “metadata generation” you mean something like “generate license compliance documents”, that definitely feasible with nixpkgs, but I wouldn’t trust the metadata to be correct. In that case you have to actually unpack the source tarballs and search for the license in there.14:19:08
@profpatsch:augsburg.oneprofpatschI think a good 80/20 solution for that could be possible and would be valuable (even as a product), but no idea whether that’s the use-case.14:19:50
@profpatsch:augsburg.oneprofpatsch(plus the tool that has the heuristics for finding license headers etc. is probably more work & value)14:20:33
@growpotkin1:matrix.orggrowpotkin1Thanks this is what I needed to hear. Yeah what I before the overlays worked fine and was simple, in cases where you do you need to override you basically had to do it statically in specific files; but that's probably easier to grokk. Maintainability is a good point aa well. I know deep down these slick overlays are going to be hard for contributors to keep clean. 17:07:59
@growpotkin1:matrix.orggrowpotkin1And yeah I'll admit I got a sweet gig here haha. Pay is a bit lower than average, but they're cool with me running off to play with Nix for six months without pressing for deliverables 😁17:11:34
@tomberek:matrix.orgtomberekWith regards to the overrides/overlay question, I've had much more luck with the more limited (though less documented) scope concept.19:26:50
@growpotkin1:matrix.orggrowpotkin1This was my take on `makeScope`. What hasn't clicked for me yet is how to nest multiple layers of scopes in a way that isn't painful. This is basically hacked together from `makeExtensible` and `makeScope` sources though : https://github.com/aameen-tulip/at-node-nix/blob/nps-scoped/lib/meta.nix#L18420:14:31
@growpotkin1:matrix.orggrowpotkin1I've also made like 3 attempts at a "recursive merge" that usually winds up "working... I think" but I have never had real confidence in them 😂 20:16:27
@growpotkin1:matrix.orggrowpotkin1Im nesting 4 layers of those scopes for Nixpkgs Node Packages Node Package "outputs" Package Meta The two outer layers are effectively a `callPackage` style scope, while the inner two are fixed points that crawl metadata and form builders. 20:19:10
@growpotkin1:matrix.orggrowpotkin1One tricky part is I can't use packages as function args, so the fixed points are actually critical for topology 20:20:14
@growpotkin1:matrix.orggrowpotkin1The metadata crawling is where things are getting messy because you can collect some of the data from multiple sources. A priority module type thing would be "nice" but I know I'd be over-engineering 20:22:03
@growpotkin1:matrix.orggrowpotkin1

Currently the __add and __update functors are more or less how I'm avoiding the complexity of "composing" overlays or fooling with priorities. It just that I can't be lazy and compose 1-4 different options for how to fetch a field into one object and "let the magic happen" which kind of sucks, but I'm not sure that stacking up and composing overlays is without its own set of frustrations.

That's one thing I was hoping to get guidance on honestly before I spend a couple of days chasing down that rabbit hole.

20:36:38
@growpotkin1:matrix.orggrowpotkin1 *

Currently the __add and __update functors are more or less how I'm avoiding the complexity of "composing" overlays or fooling with priorities. It's just that I can't be lazy and compose 1-4 different options for how to fetch a field into one object and "let the magic happen" which kind of sucks, but I'm not sure that stacking up and composing overlays is without its own set of frustrations.

That's one thing I was hoping to get guidance on honestly before I spend a couple of days chasing down that rabbit hole.

20:41:34
@tomberek:matrix.orgtomberek
In reply to @growpotkin1:matrix.org
Im nesting 4 layers of those scopes for

Nixpkgs
Node Packages
Node Package "outputs"
Package Meta

The two outer layers are effectively a `callPackage` style scope, while the inner two are fixed points that crawl metadata and form builders.

I've been iterating on a variant of this, called using that operates like this:

using pkgs {
          hello-go = ./pkgs/hello-go;
          hello-perl = ./pkgs/hello-perl;
          hello-rust = ./pkgs/hello-rust;
          haskellPackages = {
            hello-haskell-library = ./pkgs/haskellPackages/hello-haskell-library;
          };
          hello-haskell = ./pkgs/hello-haskell;
          python3Packages = using pkgs.python3Packages {
            hello-python-library = ./pkgs/python3Packages/hello-python-library;
          };
          hello-python = ./pkgs/hello-python;

}

where those libraries are available in the packages that need them and everything is automatically callPackage'd correctly. The end result is then only the packages referenced, not all of Nixpkgs, even though it can access it. It's like a recursiveCallPackageWith. The regular structure here also makes it easy to automatically create that entire call automatically by reading directories/files.

21:30:42
@tomberek:matrix.orgtomberek
In reply to @growpotkin1:matrix.org
Im nesting 4 layers of those scopes for

Nixpkgs
Node Packages
Node Package "outputs"
Package Meta

The two outer layers are effectively a `callPackage` style scope, while the inner two are fixed points that crawl metadata and form builders.
*

I've been iterating on a variant of this, called using that operates like this:

using pkgs {
          hello-go = ./pkgs/hello-go;
          hello-perl = ./pkgs/hello-perl;
          hello-rust = ./pkgs/hello-rust;
          haskellPackages = {
            hello-haskell-library = ./pkgs/haskellPackages/hello-haskell-library;
          };
          hello-haskell = ./pkgs/hello-haskell;
          python3Packages = {
            hello-python-library = ./pkgs/python3Packages/hello-python-library;
          };
          hello-python = ./pkgs/hello-python;

}

where those libraries are available in the packages that need them and everything is automatically callPackage'd correctly. The end result is then only the packages referenced, not all of Nixpkgs, even though it can access it. It's like a recursiveCallPackageWith. The regular structure here also makes it easy to automatically create that entire call automatically by reading directories/files.

21:43:20
@growpotkin1:matrix.orggrowpotkin1Now that right there is nifty21:44:07
@tomberek:matrix.orgtomberekIt seems (to me at least) easier to understand and use, but is strictly less powerful than overlay/overrides.21:44:21
@growpotkin1:matrix.orggrowpotkin1Yeah that's pretty intuitive. It reminds me a little bit of `scopedImport` but presumably less ugly 21:45:50
@growpotkin1:matrix.orggrowpotkin1Scoped important was so close to being awesome. It's heartbreaking 😂 21:46:29
@growpotkin1:matrix.orggrowpotkin1* Scoped import was so close to being awesome. It's heartbreaking 😂 21:46:37
@tomberek:matrix.orgtomberekThis approach also goes along with the thought that these objects that are called with callPackage - i've used the term protoDerivations or blueprints - allow for easier composition and re-use than turning them into packages with makeOverridable and then trying to "overrideAttrs" your way to success. So i'd say that late-calling callPackage gives us easier UX.21:49:05
@growpotkin1:matrix.orggrowpotkin1You got sources I can take for a spin? 21:50:15
@growpotkin1:matrix.orggrowpotkin1This sounds like my 3rd layer that generates builders from meta21:50:56
@growpotkin1:matrix.orggrowpotkin1This is an example of building layers 2-4. The commented blocks use an older extension object and I'm still migrating them but you'll get the idea. https://github.com/aameen-tulip/at-node-nix/blob/nps-scoped/pkgs/node-pkg-set.nix21:53:14
@tomberek:matrix.orgtombereknot yet, but we do seem to be playing in a similar design space. Let me clean things up. Not sure if this is applicable to Nixpkgs design, but might help inform it.22:01:25
@growpotkin1:matrix.orggrowpotkin1

Yeah keep in touch. And of course, feel free to expropriate patterns from my libs 🙂

I think exploring this sort of thing may be good for test driving routines that can work their way into Nixpkgs after a bit of battle testing

22:20:53
26 Jul 2022
@growpotkin1:matrix.orggrowpotkin1

Alright. My Frankenstein's monster is alive working with my over-engineered overlay system.

I won't pretend that it's "a good model" as is; but it's able to back propagate changes to higher scopes, sort of like a module system does.

Its probably misguided, but 🤷

02:10:39
@growpotkin1:matrix.orggrowpotkin1Now if only I could understand "why my code works" I'd be golden 02:14:15
@growpotkin1:matrix.orggrowpotkin1

https://github.com/aameen-tulip/at-node-nix/blob/nps-scoped/pkgs/node-pkg-set.nix

You can feed it whatever node.js garbage you have laying around, and it should give you the same derivation without regard for what "method of input" you gave.

This means if I use pkg A-1.0.0 in one lock or I pull it from a registry or I have a local copy or whatever - cache hits work.
This is the biggest issue with node2nix now - it can't "really" compose node package sets which is why Nixpkgs has to maintain a single instance and they don't recommend packaging modules as separate from CLI tools.

Oh, and I don't call NPM ever and Python only gets used when it's actually needed. Most derivations don't depend on Node even so you won't hog hydra.

02:21:02
27 Jul 2022
@chris:mkaito.netmkaitoI have to skip today's call, but I'll check the notes afterwards.14:44:35

Show newer messages


Back to Room ListRoom Version: 9