nix-super/src/libexpr/flake
Maximilian Bosch 2b02ce0e48
libexpr: throw a more helpful eval-error if a builtin is not available due to a missing feature-flag
I found it somewhat confusing to have an error like

    error: attribute 'getFlake' missing

if the required experimental-feature (`flakes`) is not enabled. Instead,
I'd expect Nix to throw an error just like it's the case when using e.g. `nix
flake` without `flakes` being enabled.

With this change, the error looks like this:

    $ nix-instantiate -E 'builtins.getFlake "nixpkgs"'
    error: Cannot call 'builtins.getFlake' because experimental Nix feature 'flakes' is disabled. You can enable it via '--extra-experimental-features flakes'.

           at «string»:1:1:

                1| builtins.getFlake "nixpkgs"
                 | ^

I didn't use `settings.requireExperimentalFeature` here on purpose
because this doesn't contain a position. Also, it doesn't seem as if we
need to catch the error and check for the missing feature here since
this already happens at evaluation time.
2021-09-29 11:57:15 +02:00
..
call-flake.nix Represent 'follows' inputs explicitly in the lock file 2020-06-11 14:40:21 +02:00
config.cc Whitelist nixConfig.flake-registry 2021-08-07 14:42:59 +03:00
flake.cc libexpr: throw a more helpful eval-error if a builtin is not available due to a missing feature-flag 2021-09-29 11:57:15 +02:00
flake.hh If we can't write a lock file, pretend the top-level flake is dirty 2021-09-15 18:31:42 +02:00
flakeref.cc Set input parent at construction time 2021-09-21 14:07:16 +02:00
flakeref.hh Switch comment format from '// ...' to '/* ... */' for consistency. 2020-09-28 09:37:26 -07:00
lockfile.cc In flake lock file diffs, show the last-modified date of inputs if available 2021-08-11 19:35:28 +02:00
lockfile.hh Capitalize JSON for consistency 2020-10-28 17:54:28 -05:00