Files
nix/src/libexpr
Eelco Dolstra 188d97e1f1 Restore input substitution
The ability to substitute inputs was removed in #10612 because it was
broken: with user-specified inputs containing a `narHash` attribute,
substitution resulted in an input that lacked the attributes returned
by the real fetcher (such as `lastModified`).

To fix this, we introduce a new input attribute `final`. If `final =
true`, fetching the input cannot add or change any attributes.

We only attempt to substitute inputs that have `final = true`. This is
implied by lock file entries; we only write a lock file if all its
entries are "final".

The user can specified `final = true` in `fetchTree`, in which case it
is their responsibility to ensure that all attributes returned by the
fetcher are included in the `fetchTree` call. For example,

  nix eval --impure --expr 'builtins.fetchTree { type = "github"; owner = "NixOS"; repo = "patchelf"; final = true; narHash = "sha256-FSoxTcRZMGHNJh8dNtKOkcUtjhmhU6yQXcZZfUPLhQM="; }'

succeeds in a store path with the specified NAR hash exists or is
substitutable, but fails with

  error: fetching final input '{"final":true,"narHash":"sha256-FSoxTcRZMGHNJh8dNtKOkcUtjhmhU6yQXcZZfUPLhQM=","owner":"NixOS","repo":"patchelf","type":"github"}' resulted in different input '{"final":true,"lastModified":1718457448,"narHash":"sha256-FSoxTcRZMGHNJh8dNtKOkcUtjhmhU6yQXcZZfUPLhQM=","owner":"NixOS","repo":"patchelf","rev":"a0f54334df36770b335c051e540ba40afcbf8378","type":"github"}'
2024-10-15 20:55:05 +02:00
..
2024-02-08 11:58:25 -08:00
2024-07-02 09:23:24 -04:00
2024-07-24 16:52:04 +02:00
2024-10-15 20:55:05 +02:00
2024-06-10 12:46:04 +02:00
2024-07-11 11:35:58 +02:00
2024-07-02 09:26:22 -04:00
2023-02-10 18:38:57 +01:00
2024-07-25 15:48:58 -04:00
2024-02-08 11:01:41 -05:00
2024-07-17 13:31:31 +02:00
2024-02-08 11:58:25 -08:00