!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
27 Sep 2023
@infinisil:matrix.orginfinisil Yeah, well I'm glad I was able to explain it, it's useful specific to nixpkgs-check-by-name, but a CI retrigger is a decent fix the other general problem :) 19:49:34
@infinisil:matrix.orginfinisil * Yeah, well I'm glad I was able to explain it, it's useful specific to nixpkgs-check-by-name, but a CI retrigger is a decent fix for the other general problem :) 19:49:44
@infinisil:matrix.orginfinisilOh and I guess this could also be useful if it's too expensive to re-trigger the CI check for all affected PR's19:52:08
@infinisil:matrix.orginfinisil (not the case for nixpkgs-check-by-name) 19:52:22
@infinisil:matrix.orginfinisilKind of nice how this approach allows a gradual rollout of a new CI check though. And you can kind of control the amount of the rollout based on how quickly you fix the base branch when the new check starts failing on it.19:58:30
@infinisil:matrix.orginfinisil * Kind of nice how this approach allows a gradual rollout of a new CI check without using any extra resources though. And you can kind of control the amount of the rollout based on how quickly you fix the base branch when the new check starts failing on it.19:58:46
@infinisil:matrix.orginfinisilNice, the RFC 140 tool prevented the double addition of a package: https://github.com/NixOS/nixpkgs/pull/25756521:12:28
28 Sep 2023
@infinisil:matrix.orginfinisilThis is fairly small, kind of neat and self-contained, reviews appreciated: https://github.com/NixOS/nixpkgs/pull/25773500:06:25
2 Oct 2023
@atra1n:matrix.org@atra1n:matrix.org joined the room.01:42:33
@infinisil:matrix.orginfinisil Here's the current plan for the RFC 140 migration, I'd like to talk about that in tomorrows NAT meeting and optionally schedule a longer call if it needs to be discussed further: https://github.com/NixOS/nixpkgs/issues/258650 (cc Robert Hensing (roberth) John Ericson tomberek growpotkin ( Alex Ameen ) DavHau phaer) 20:30:22
@infinisil:matrix.orginfinisilIf anybody has items they want to talk about, please add them to the agenda in the meeting notes here: https://pad.lassul.us/uIi7xeSJTW6LJUEHulZgVQ?edit20:32:48
@infinisil:matrix.orginfinisil * If anybody has other items they want to talk about, please add them to the agenda in the meeting notes here: https://pad.lassul.us/uIi7xeSJTW6LJUEHulZgVQ?edit20:32:55
@tomberek:matrix.orgtomberekI will be on a plane. ✈️20:55:37
@hsngrmpf:matrix.orgDavHauI'm not sure if I can make it tomorrow22:21:15
3 Oct 2023
@infinisil:matrix.orginfinisil Ping John Ericson growpotkin ( Alex Ameen ) phaer DavHau 13:01:40
@infinisil:matrix.orginfinisilMeeting now in https://meet.jit.si/nixpkgs-architecture, meeting notes: https://pad.lassul.us/uIi7xeSJTW6LJUEHulZgVQ?edit13:03:36
@growpotkin:matrix.orgGrowpotkin2023-10-03-080326_503x673_scrot.png
Download 2023-10-03-080326_503x673_scrot.png
13:03:47
@Ericson2314:matrix.orgJohn Ericson I'm sorry infinisil I slept poorly on and off for a long time and just woke up. I did look at the PRs a bit yesterday and the test both state and compare approach looked rock solid (I kind of want that for all CI checks now!) 13:47:59
@infinisil:matrix.orginfinisilNo problem, glad you approve of it! :D13:49:08
@Ericson2314:matrix.orgJohn EricsonHopefully next one I am not sick and not jetlagged and can join properly!13:59:06
@infinisil:matrix.orginfinisil John Ericson: If you want to discuss it we can also just schedule an ad-hoc call :) 14:17:19
@Ericson2314:matrix.orgJohn EricsonI don't think I have to much to add, just sorry about being an AWOL team member! 14:17:55
@Ericson2314:matrix.orgJohn EricsonI can go review these things async and slap some approvals on them14:18:06
@infinisil:matrix.orginfinisil DavHau: Sorry we didn't have time today, do you have a link to check out what you wanted to show? 14:54:23
@hsngrmpf:matrix.orgDavHau

DISCLAIMER: This is just an experiment

I made this fork of nixpkgs, which uses the module system for all mkDerivation based packages. All changes are contained in the latest commit.

Done:

  • in make-derivation.nix replace call to builtins.derivation with lib.evalModules
  • declare interface using the module system
  • its based on Robert Hensing (roberth) 's WIP record type for performance reasons (submodule+freeform was quite slow)
  • the defined options are incomplete -> unknown fields default to types.raw
  • added modules argument to mkDerivation allowing user to pass extra modules (cool, but still requires calling overrideAttrs which is weird)
  • pass through .mix function for each derivation, that allows passing a single module to extend the derivation.

Example usage:

Overriding

overriding before:

firefox.overrideAttrs (old: {buildInputs = old.buildInputs or [] ++ [hello];})

overriding after:

firefox.mix {derivation.buildInputs = [hello];}
  • no need to pass function
  • no need to handle previous value
  • no need to handle default
  • no need to implement merge

Type Checking

nix-repl> firefox.mix {derivation.buildInputs = {};}
error:
[...]
       error: A definition for option `derivation.buildInputs' is not of type `list of (null or package or path)'.
       [...]

Performance

(None of these findings are thoroughly tested or statistically sound)

  • Overhead on packages with small closure is little (~10% for pkgs.hello)
  • Overhead on packages with large closure is high: (~100% for pkgs.firefox)
  • Overhead when evaluating all packages is between 100 to 200%

Other findings:

  • Increasing the number of type checked fields didn't seem to increase the overhead significantly

My main question is: What are the next steps? Is there something useful to make out of this?
Some Ideas:

  • deliver this as an overlay to allow experimentation on any nixpkgs version
  • finish the interface declaration and make a CI job for nixpkgs that does type checking for all packages (we did notice that some packages pass weird types to some fields, like a list of lists for build inputs. It just doesn't end up being a problem because of how stuff gets converted to strings in derivation)
  • do some more sophisticated benchmarks that can be reproduced and used to optimize the module system.
16:25:19
@infinisil:matrix.orginfinisil

DavHau: Nice! This would be great to have in a GitHub issue, in Matrix it's easily lost.

I'd like some more detailed benchmarks, including what exactly is being benchmarked (is it the same that ofborg uses? that would be a good indication). Also not just time (I assume that's what you measured), but also memory usage.

Just from the numbers you gave though, I think this clearly demonstrates that it's too inefficient and we really need to improve performance of the module system to make this work.

16:34:20
@roberthensing:matrix.orgRobert Hensing (roberth) Possibly overhead can be further reduced by avoiding evalModules ("types.submodule") in favor of something simpler like types.fix (types.record) but also extensible 16:34:41
@roberthensing:matrix.orgRobert Hensing (roberth)It'd be somewhere between the module system and minimod I guess16:35:06
@hsngrmpf:matrix.orgDavHauYes, I just measured the time. I haven't much experience on how to do proper benchmarks with nix. Any hints or docs regarding this are appreciated. I can look at ofborgs implementation I guess.16:38:17
@infinisil:matrix.orginfinisilHere's an example of ofborg's performance report: https://github.com/NixOS/nixpkgs/pull/258804/checks?check_run_id=1735659300916:38:34

Show newer messages


Back to Room ListRoom Version: 9