1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 08:31:16 +02:00
nix/src
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
..
build-remote build-remote: only allocate storeUri once 2024-07-25 14:04:03 +02:00
external-api-docs packaging: Add mesonLayer 2024-10-13 22:39:53 +02:00
internal-api-docs packaging: Add mesonLayer 2024-10-13 22:39:53 +02:00
libcmd packaging: Add mkMeson{Library,Executable} 2024-10-13 23:17:54 +02:00
libexpr Restore input substitution 2024-10-15 20:55:05 +02:00
libexpr-c packaging: Add mkMeson{Library,Executable} 2024-10-13 23:17:54 +02:00
libfetchers Restore input substitution 2024-10-15 20:55:05 +02:00
libflake Restore input substitution 2024-10-15 20:55:05 +02:00
libmain packaging: Add mkMeson{Library,Executable} 2024-10-13 23:17:54 +02:00
libmain-c packaging: Add mkMeson{Library,Executable} 2024-10-13 23:17:54 +02:00
libstore Merge pull request #11688 from roberth/meson-tidy 2024-10-14 17:40:46 +02:00
libstore-c packaging: Add mkMeson{Library,Executable} 2024-10-13 23:17:54 +02:00
libutil packaging: Add mkMeson{Library,Executable} 2024-10-13 23:17:54 +02:00
libutil-c packaging: Add mkMeson{Library,Executable} 2024-10-13 23:17:54 +02:00
nix packaging: Add mkMeson{Library,Executable} 2024-10-13 23:17:54 +02:00
nix-build MacOS built: add workaround for missing view() member of std::ostringstream 2024-10-07 02:05:53 +02:00
nix-channel Don't use OS_STR in nix-channel.cc 2024-08-18 18:27:20 +05:30
nix-collect-garbage More std::filesystem for nix-collect-garbage 2024-08-26 17:29:23 -04:00
nix-copy-closure Restrict some code to StoreDirConfig 2023-11-04 19:05:36 -04:00
nix-env MacOS built: add workaround for missing view() member of std::ostringstream 2024-10-07 02:05:53 +02:00
nix-instantiate No global settings in libnixfetchers and libnixflake 2024-07-12 08:50:28 -04:00
nix-store Make abort() call sites log first 2024-07-24 16:52:04 +02:00
perl packaging: Add mkMeson{Library,Executable} 2024-10-13 23:17:54 +02:00
nix-expr-test-support Put back files for now 2024-07-02 09:26:22 -04:00
nix-expr-tests Put back files for now 2024-07-02 09:26:22 -04:00
nix-fetchers-tests Put back files for now 2024-07-02 09:26:22 -04:00
nix-flake-tests Put back files for now 2024-07-02 09:26:22 -04:00
nix-functional-tests Build Functional tests with Meson 2024-08-14 15:35:40 -04:00
nix-manual Build the manual with Meson 2024-10-09 11:58:17 -04:00
nix-store-test-support Put back files for now 2024-07-02 09:26:22 -04:00
nix-store-tests Put back files for now 2024-07-02 09:26:22 -04:00
nix-util-test-support Put back files for now 2024-07-02 09:26:22 -04:00
nix-util-tests Put back files for now 2024-07-02 09:26:22 -04:00