aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
AgeCommit message (Collapse)Author
2021-11-05Make the flake options work when using the daemonregnat
When setting flake-local options (with the `nixConfig` field), forward these options to the daemon in case we’re using one. This is necessary in particular for options like `binary-caches` or `post-build-hook` to make sense. Fix <https://github.com/NixOS/nix/commit/343239fc8a1993f707a990c2cd54a41f1fa3de99#r44356843>
2021-10-27Remove redundant 'warning:'Eelco Dolstra
2021-10-26Tweak fetchTree docsEelco Dolstra
2021-10-26Make experimental-features a proper typeregnat
Rather than having them plain strings scattered through the whole codebase, create an enum containing all the known experimental features. This means that - Nix can now `warn` when an unkwown experimental feature is passed (making it much nicer to spot typos and spot deprecated features) - It’s now easy to remove a feature altogether (once the feature isn’t experimental anymore or is dropped) by just removing the field for the enum and letting the compiler point us to all the now invalid usages of it.
2021-10-17fetch: nicer infinite recursion errorsKevin Amado
- This change applies to builtins.fetchurl and builtins.fetchTarball - PoC: `let x = builtins.fetchurl x; in x` - Before: ```bash $ nix-instantiate --extra-experimental-features flakes --strict error: infinite recursion encountered ``` - After: ```bash $ nix-instantiate --extra-experimental-features flakes --strict error: infinite recursion encountered at /data/github/kamadorueda/nix/test.nix:1:9: 1| let x = builtins.fetchurl x; in x | ^ ``` Mentions: #3505
2021-10-15fetchTree: add pos to EvalState::forceValueKevin Amado
- This way we improve error messages on infinite recursion - Demo: ```nix let x = builtins.fetchTree { type = "git"; inherit x; }; in x ``` - Before: ```bash $ nix-instantiate --extra-experimental-features flakes --strict error: infinite recursion encountered ``` - After: ```bash $ nix-instantiate --extra-experimental-features flakes --strict error: infinite recursion encountered at /data/github/kamadorueda/nix/test.nix:3:10: 2| type = "git"; 3| inherit x; | ^ 4| }; ``` Mentions: #3505
2021-10-15fetchTree: add pos to EvalState::forceValueKevin Amado
- This way we improve error messages on infinite recursion - Demo: ```nix let x = builtins.fetchTree x; in x ``` - Before: ```bash $ nix-instantiate --extra-experimental-features flakes --strict error: infinite recursion encountered ``` - After: ```bash $ nix-instantiate --extra-experimental-features flakes --strict error: infinite recursion encountered at /data/github/kamadorueda/nix/test.nix:1:9: 1| let x = builtins.fetchTree x; | ^ 2| in x ``` Mentions: #3505
2021-10-14add pos to EvalState::forceValueKevin Amado
- This way we improve error messages on infinite recursion - Demo: ```nix let x = builtins.fetchMercurial x; in x ``` - Before: ```bash $ nix-instantiate --show-trace --strict error: infinite recursion encountered ``` - After: ```bash nix-instantiate --show-trace --strict error: infinite recursion encountered at /data/github/kamadorueda/test/default.nix:2:7: 1| let 2| x = builtins.fetchMercurial x; | ^ 3| in ``` Mentions: #3505
2021-10-11(partially) Revert "Don't copy in rethrow"regnat
This reverts some parts of commit 8430a8f0866e4463a891ccce62779ea9ac0f3b38 which was trying to rethrow some exceptions while we weren’t in the context of a `catch` block, causing some weird “terminate called without an active exception” errors. Fix #5368
2021-10-07Make builtins.{path,filterSource} work with chroot storesEelco Dolstra
2021-10-07Add a trace to all errors in addPath()Eelco Dolstra
2021-10-07Allow builtins.{path,filterSource} on paths with a contextEelco Dolstra
We now build the context (so this has the side-effect of making builtins.{path,filterSource} work on derivations outputs, if IFD is enabled) and then check that the path has no references (which is what we really care about).
2021-10-07Remove unnecessary call to queryMissing()Eelco Dolstra
Worker::run() already does this.
2021-10-07Allow access to path copied to the storeEelco Dolstra
Fixes https://github.com/NixOS/nix/pull/5163#issuecomment-931733912.
2021-10-07Refactoring: Add allowPath() methodEelco Dolstra
2021-10-07Merge pull request #5341 from andir/libexpr-formalsEelco Dolstra
libexpr: remove matchAttrs boolean from ExprLambda
2021-10-06Merge pull request #5286 from ilkecan/add-a-warning-to-filterSourceEelco Dolstra
Warn about the usage of filterSource with Nix store paths
2021-10-06Add a warning to `filterSource`ilkecan
Warn about the usage of `filterSource` with Nix store paths
2021-10-06Remove no-op call to realiseContext()Eelco Dolstra
2021-10-06Merge branch 'flakes_filterSource' of https://github.com/tomberek/nixEelco Dolstra
2021-10-06fetchTree(): Parse type attribute firstEelco Dolstra
The 'url' attribute depends on whether type == 'git', so this is needed for builtins.fetchTree {url = "git@github.com:NixOS/nix.git"; type = "git";}
2021-10-06CleanupEelco Dolstra
2021-10-06libexpr: remove matchAttrs boolean from ExprLambdaAndreas Rammhold
The boolean is only used to determine if the formals are set to a non-null pointer in all our cases. We can get rid of that allocation and instead just compare the pointer value with NULL. Saving up to sizeof(bool) + platform specific alignment per ExprLambda instace. Probably not a lot of memory but perhaps a few kilobyte with nixpkgs? This also gets rid of a potential issue with dereferencing formals based on the value of the boolean that didn't have to be aligned with the formals pointer but was in all our cases.
2021-10-06Merge branch 'considerate/scp-like-urls' of https://github.com/considerate/nixEelco Dolstra
2021-09-30`std::visit` by referenceJohn Ericson
I had started the trend of doing `std::visit` by value (because a type error once mislead me into thinking that was the only form that existed). While the optomizer in principle should be able to deal with extra coppying or extra indirection once the lambdas inlined, sticking with by reference is the conventional default. I hope this might even improve performance.
2021-09-29reset yylloc when yyless(0) is calledTaeer Bar-Yam
2021-09-29Merge pull request #5301 from Ma27/builtins-missing-feature-errorEelco Dolstra
libexpr: throw a more helpful eval-error if a builtin is not available due to a missing feature-flag
2021-09-29libexpr: throw a more helpful eval-error if a builtin is not available due ↵Maximilian Bosch
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-27Don't copy in rethrowEelco Dolstra
2021-09-24Merge pull request #5253 from edolstra/flake-ifdEelco Dolstra
Don't allow IFD in flakes by default
2021-09-22Revert "Merge pull request #4922 from nrdxp/default-submodules"Eelco Dolstra
This reverts commit 6678e98411cd3bfe8143a4ba1b35d1451babce32, reversing changes made to 90b2dd570cbd8313a8cf45b3cf66ddef2bb06e07.
2021-09-22Don't cache realiseContext() errorsEelco Dolstra
Errors that depend on the configuration (such as whether allow-import-from-derivation is set) should not be cached.
2021-09-21Set input parent at construction timeEelco Dolstra
2021-09-16Include subpath in flake fingerprintGeoff Reedy
Without this, flakes within the same tree and same lock data will have the same fingerprint and the eval cache for one flake will be incorrectly used for another.
2021-09-15Merge pull request #5257 from edolstra/dirty-lock-fileEelco Dolstra
If we can't write a lock file, pretend the top-level flake is dirty
2021-09-15Merge branch 'mh/fix-chroot-eval' of https://github.com/obsidiansystems/nixEelco Dolstra
2021-09-15If we can't write a lock file, pretend the top-level flake is dirtyEelco Dolstra
Alternative to #4639. You can still read flake.lock, but at least in reproducible workflows like NixOS configurations where you require a non-dirty tree, evaluation will fail because there is no rev.
2021-09-15Revert "Disallow reading flake.lock"Eelco Dolstra
This reverts commit e5596113f7fc5e47e058bb15afdf75eee02ed95e.
2021-09-14Disallow reading flake.lockEelco Dolstra
With --no-write-lock-file, it's possible that flake.lock is out of sync with the actual inputs used by the evaluation. So doing fromJSON (readFile ./flake.lock) will give wrong results. Fixes #4639.
2021-09-14Merge pull request #5240 from edolstra/builtin-helpEelco Dolstra
nix --help: Display help using lowdown instead of man
2021-09-13hashFile, hashString: realize context before calculation, and discard afterwardskvtb
2021-09-13nix --help: Display help using lowdown instead of manEelco Dolstra
Fixes #4476. Fixes #5231.
2021-09-08Merge pull request #5215 from ncfavier/patch-1Eelco Dolstra
Fix use-registries logic in builtins.getFlake
2021-09-07Merge pull request #4922 from nrdxp/default-submodulesShea Levy
libfetchers/git: fetch submodules by default
2021-09-05Fix use-registries logic in builtins.getFlakeNaïm Favier
2021-09-01Merge pull request #5066 from Radvendii/masterEelco Dolstra
add antiquotations to paths
2021-08-31fix parse of `/${foo}`. was `// + foo`Taeer Bar-Yam
I don't think this changes the way any program would behave, but it's a cleaner internal representation.
2021-08-31path antiquotations: canonizePath -> canonicalizePathTaeer Bar-Yam
2021-08-30Merge pull request #5175 from Pamplemousse/makeEelco Dolstra
Don't overwrite user provided `lib*_LDFLAGS`
2021-08-30Merge pull request #5191 from hercules-ci/evalstate-lifetime-hygieneEelco Dolstra
EvalState lifetime hygiene