Subject: reference-scanning inputDrvs/inputSrcs

From: Adam Joseph <[email-masked]>
Date: Tue, 10 Jan 2023 12:20:18 -0800

Quoting Adam Joseph (2022-12-02 15:22:13)
> I've written a tool (using the awesome libnixstore crate) that calculates
> drv.inputDrvs using scanForReferences instead of string contexts, and compares
> the calculated results to what cppnix produced....  In a week or two I'm
> going to clean it up and write a post about it on the nixos discourse

Just want to mention that I haven't forgotten about this, but it is on hold for
a while because of two things:

1. Much as I loathe C++, I should implement this in cppnix first rather than in
   tvix because:

   a. If I don't get it exactly right on the first try, tvix will get the blame
      for any behavioral differences, and that is not cool.  The implementation
      is straightforward and obvious except for placeholders and
      unsafeDiscardOutputDependency -- those are subtle, and I can't be sure
      I'll get them right on the first try.

   b. Cppnix is already in production use.  It can calculates scanned-inputDrvs
      *in addition to* string-context inputDrvs, and emit a warning if they
      disagree.  Having no warnings on a large production codebase (nixpkgs,
      maybe even Hydra) for a few months is the sign that it ready for an RFC.

2. Nix will need scanned-inputDrvs anyways in order for Ericson2314's "EBB"
   derivations-that-emit-derivations-without-using-nixlang to be practically
   useful.  So I am going to wait for nix#3959 to merge before I try to
   implement scanned-inputDrvs for cppnix.  I will be much easier to convince
   people of its usefulness at that point.

     https://github.com/NixOS/nix/pull/3959
     https://github.com/NixOS/nix/pull/3959#issuecomment-1375508978

You may not hear much from me for the next month or two.  I have been dragged
into a really enormous project that I have been wanting to do for a long time:

  https://github.com/NixOS/nixpkgs/pull/209870

Getting such a major change approved only happens if it resolves some kind of
excruciating pain.  Fortunately that excruciating pain is present right now:

  https://github.com/NixOS/nixpkgs/issues/108305

So #209870 is my top priority right now because at the moment it is very easy to
convince people that it is useful.

  - a