aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops
AgeCommit message (Collapse)Author
2022-03-01Merge pull request #6185 from hercules-ci/fetchTree-reuse-local-pathsEelco Dolstra
fetchTree: Use isValidPath, add comment
2022-03-01fetchTree: Use isValidPath, add commentRobert Hensing
2022-03-01fetch{url,Tarball}: Remove 'narHash' attributeEelco Dolstra
This was introduced in #6174. However fetch{url,Tarball} are legacy and we shouldn't have an undocumented attribute that does the same thing as one that already exists ('sha256').
2022-02-28Add EvalState::allowAndSetStorePathString helperRobert Hensing
This switches addPath from `printStorePath` to `toRealPath`.
2022-02-28fetchTree: Do not re-fetch paths already presentRobert Hensing
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2022-02-24libfetchers: Rename immutable -> lockedEelco Dolstra
This is more consistent with flake terminology.
2022-01-27optionally return string_view from coerceToStringpennae
we'll retain the old coerceToString interface that returns a string, but callers that don't need the returned value to outlive the Value it came from can save copies by using the new interface instead. for values that weren't stringy we'll pass a new buffer argument that'll be used for storage and shouldn't be inspected.
2022-01-27return string_views from forceString*pennae
once a string has been forced we already have dynamic storage allocated for it, so we can easily reuse that storage instead of copying.
2022-01-04Remove non-method mk<X> functionsEelco Dolstra
2022-01-04Remove non-method mkString()Eelco Dolstra
2022-01-04Ensure that attrsets are sortedEelco Dolstra
Previously you had to remember to call value->attrs->sort() after populating value->attrs. Now there is a BindingsBuilder helper that wraps Bindings and ensures that sort() is called before you can use it.
2021-12-28Sort attrs from tables in fromTOMLLily Foster
This was dropped in 10a8b5d for the migration from cpptoml to toml11 but seems to be necessary for the attrsets to work correctly. Fixes #5833
2021-12-23Use int64_t and NixFloat in fromTOML typesNicolas Mattia
This makes sure that values parsed from TOML have a proper size. Using e.g. `double` caused issues on i686 where the size of `double` (32bit) was too small to accommodate some values.
2021-12-20Clean up toml parsing codeNicolas Mattia
2021-12-17Use long in fromTOMLNicolas Mattia
2021-12-17Update primops/fromTOML.cc to use toml11Nicolas Mattia
2021-11-25Support range-based for loop over list valuesEelco Dolstra
2021-11-17Simplify fix by disallowing / in front of @ to match scp styleKalle Jepsen
2021-11-17Fix detection of scp-style URIs to support non-standard SSH ports for gitKalle Jepsen
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-07Make builtins.{path,filterSource} work with chroot storesEelco Dolstra
2021-10-07Refactoring: Add allowPath() methodEelco 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-06Merge branch 'considerate/scp-like-urls' of https://github.com/considerate/nixEelco Dolstra
2021-09-22Revert "Merge pull request #4922 from nrdxp/default-submodules"Eelco Dolstra
This reverts commit 6678e98411cd3bfe8143a4ba1b35d1451babce32, reversing changes made to 90b2dd570cbd8313a8cf45b3cf66ddef2bb06e07.
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-07Merge pull request #4922 from nrdxp/default-submodulesShea Levy
libfetchers/git: fetch submodules by default
2021-08-05Use the store path as the context of the result of fetchTree, not the real pathMadeline Haraj
2021-07-30Support SCP-like URLs in builtins.fetchGit attrsViktor Kronvall
This extends https://github.com/NixOS/nix/pull/4978 with supporting the SCP-like urls in expressions like ```nix builtins.fetchGit { url = "git@github.com:NixOS/nix.git"; ref = "master"; } ```
2021-07-09Merge pull request #4995 from NixOS/fetchgit-name-attributeEelco Dolstra
Fix the `name` attribute in builtins.fetchGit
2021-07-08Restore the possibility to use a `name` parameter in fetchGitregnat
Accidentally broken by 7e5c79a2d210e7b986803d5fe5c7ebb504b3e74e
2021-07-08Merge pull request #4988 from NixOS/fetchgit-name-attributeEelco Dolstra
Add a name attribute to the fetchers
2021-07-08Forbid the `name` attribute for fetchTreeregnat
We need to support it for the “old” fetch* functions for backwards compatibility, but we don’t need it for fetchTree (as it’s a new function). Given that changing the `name` messes-up the content hashing, we can just forbid passing a custom `name` argument to it
2021-07-06allow fetchMercurial to take a `name` argumentregnat
2021-07-02Allow scp-style uris in `fetchgit`regnat
Fix #5303
2021-06-17libfetchers/git: fetch submodules by defaultTimothy DeHerrera
2021-04-23Replace the trailing markdown spaces by a backslashregnat
They are equivalent according to <https://spec.commonmark.org/0.29/#hard-line-breaks>, and the trailing spaces tend to be a pain (because the make git complain, editors tend to want to remove them − the `.editorconfig` actually specifies that − etc..).
2021-01-25Add FIXMEEelco Dolstra
2021-01-21Improve error formattingEelco Dolstra
Changes: * The divider lines are gone. These were in practice a bit confusing, in particular with --show-trace or --keep-going, since then there were multiple lines, suggesting a start/end which wasn't the case. * Instead, multi-line error messages are now indented to align with the prefix (e.g. "error: "). * The 'description' field is gone since we weren't really using it. * 'hint' is renamed to 'msg' since it really wasn't a hint. * The error is now printed *before* the location info. * The 'name' field is no longer printed since most of the time it wasn't very useful since it was just the name of the exception (like EvalError). Ideally in the future this would be a unique, easily googleable error ID (like rustc). * "trace:" is now just "…". This assumes error contexts start with something like "while doing X". Example before: error: --- AssertionError ---------------------------------------------------------------------------------------- nix at: (7:7) in file: /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/default.nix 6| 7| x = assert false; 1; | ^ 8| assertion 'false' failed ----------------------------------------------------- show-trace ----------------------------------------------------- trace: while evaluating the attribute 'x' of the derivation 'hello-2.10' at: (192:11) in file: /home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/make-derivation.nix 191| // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) { 192| name = "${attrs.pname}-${attrs.version}"; | ^ 193| } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) { Example after: error: assertion 'false' failed at: (7:7) in file: /home/eelco/Dev/nixpkgs/pkgs/applications/misc/hello/default.nix 6| 7| x = assert false; 1; | ^ 8| … while evaluating the attribute 'x' of the derivation 'hello-2.10' at: (192:11) in file: /home/eelco/Dev/nixpkgs/pkgs/stdenv/generic/make-derivation.nix 191| // (lib.optionalAttrs (!(attrs ? name) && attrs ? pname && attrs ? version)) { 192| name = "${attrs.pname}-${attrs.version}"; | ^ 193| } // (lib.optionalAttrs (stdenv.hostPlatform != stdenv.buildPlatform && !dontAddHostSuffix && (attrs ? name || (attrs ? pname && attrs ? version)))) {
2020-12-28FixupMatthew Bauer
2020-12-24Merge branch 'master' into support-libcxx10Matthew Bauer