aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/primops
AgeCommit message (Collapse)Author
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
2020-12-23Cast variants fully for libc++10Matthew Bauer
libc++10 seems to be stricter on what it allows in variant conversion. I'm not sure what the rules are here, but this is the minimal change needed to get through the compilation errors.
2020-12-22Document `allRefs` argument of `builtins.fetchTree`Maximilian Bosch
2020-12-17Rename Value::normalType() -> Value::type()Silvan Mosberger
2020-12-12Use Value::normalType on all forced values instead of Value::typeSilvan Mosberger
2020-11-26builtins.fetchGit: Fix shortRev attribute for dirty treesEelco Dolstra
2020-10-29Alter "wanted:" to "specified:" in hash mismatch outputstev
This makes it even clearer which of the two hashes was specified in the nix files. Some may think that "wanted" and "got" is obvious, but: "got" could mean "got in nix file" and "wanted" could mean "want to see in nix file".
2020-10-26Move ExplicitEelco Dolstra
2020-10-06Remove static variable name clashesEelco Dolstra
This was useful for an experiment with building Nix as a single compilation unit. It's not very useful otherwise but also doesn't hurt...
2020-09-29Make Headers an optional argumentEelco Dolstra
2020-09-25Merge remote-tracking branch 'origin/master' into github-api-tokenGregory Hale
2020-09-21Don't include <regex> in header filesEelco Dolstra
This reduces compilation time by ~15 seconds (CPU time). Issue #4045.
2020-09-17Remove corepkgs/derivation.nixEelco Dolstra
2020-09-16Fetch commits from github/gitlab using Auth headerGreg Hale
`nix flake info` calls the github 'commits' API, which requires authorization when the repository is private. Currently this request fails with a 404. This commit adds an authorization header when calling the 'commits' API. It also changes the way that the 'tarball' API authenticates, moving the user's token from a query parameter into the Authorization header. The query parameter method is recently deprecated and will be disallowed in November 2020. Using them today triggers a warning email.
2020-08-24Move primop docs inlineEelco Dolstra
This makes them available to 'nix repl'.
2020-08-05Remove optionality in ValidPathInfo::narInfoCarlo Nucera
2020-07-30Merge branch 'master' of github.com:NixOS/nix into better-ca-parse-errorsCarlo Nucera
2020-07-28Restore backwards-compat for current `builtins.fetchGit`Maximilian Bosch
If a repo is dirty, it used to return a `rev` object with an "empty" sha1 (0000000000000000000000000000000000000000). Please note that this only applies for `builtins.fetchGit` and *not* for `builtins.fetchTree{ type = "git"; }`.
2020-07-28Merge legacy `fetchGit`-builtin with the generic `fetchTree`-functionMaximilian Bosch
The original idea was to implement a git-fetcher in Nix's core that supports content hashes[1]. In #3549[2] it has been suggested to actually use `fetchTree` for this since it's a fairly generic wrapper over the new fetcher-API[3] and already supports content-hashes. This patch implements a new git-fetcher based on `fetchTree` by incorporating the following changes: * Removed the original `fetchGit`-implementation and replaced it with an alias on the `fetchTree` implementation. * Ensured that the `git`-fetcher from `libfetchers` always computes a content-hash and returns an "empty" revision on dirty trees (the latter one is needed to retain backwards-compatibility). * The hash-mismatch error in the fetcher-API exits with code 102 as it usually happens whenever a hash-mismatch is detected by Nix. * Removed the `flakes`-feature-flag: I didn't see a reason why this API is so tightly coupled to the flakes-API and at least `fetchGit` should remain usable without any feature-flags. * It's only possible to specify a `narHash` for a `git`-tree if either a `ref` or a `rev` is given[4]. * It's now possible to specify an URL without a protocol. If it's missing, `file://` is automatically added as it was the case in the original `fetchGit`-implementation. [1] https://github.com/NixOS/nix/pull/3216 [2] https://github.com/NixOS/nix/pull/3549#issuecomment-625194383 [3] https://github.com/NixOS/nix/pull/3459 [4] https://github.com/NixOS/nix/pull/3216#issuecomment-553956703
2020-07-16Merge branch 'hash-always-has-type' of github.com:obsidiansystems/nix into ↵John Ericson
better-ca-parse-errors
2020-07-16Merge remote-tracking branch 'upstream/master' into hash-always-has-typeJohn Ericson
2020-07-13Merge remote-tracking branch 'upstream/master' into hash-always-has-typeJohn Ericson
2020-07-06Merge branch 'master' of github.com:NixOS/nix into better-ca-parse-errorsCarlo Nucera
2020-07-06Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-07-01Rename two hash constructors to proper functionsCarlo Nucera
2020-06-26Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-23use plain errPos instead of nixCode; fix testsBen Burdette
2020-06-23Merge remote-tracking branch 'upstream/master' into hash-always-has-typeJohn Ericson
2020-06-19WIP: Make Hash always store a valid hash typeJohn Ericson
2020-06-18Merge branch 'validPathInfo-temp' into validPathInfo-ca-proper-datatypeJohn Ericson
2020-06-17Merge remote-tracking branch 'origin/master' into flakesEelco Dolstra
2020-06-15Get rid of explicit ErrorInfo constructorsEelco Dolstra
2020-06-15Merge branch 'errors-phase-2' of https://github.com/bburdette/nixEelco Dolstra
2020-06-12Merge pull request #3674 from matthewbauer/allow-empty-hash2Eelco Dolstra
Allow empty hash in derivations
2020-06-12Add newHashAllowEmpty helper functionMatthew Bauer
This replaces the copy&paste with a helper function in hash.hh.
2020-06-11Merge remote-tracking branch 'upstream/master' into errors-phase-2Ben Burdette
2020-06-09Support empty hash in fetchersMatthew Bauer
fetchTarball, fetchTree, and fetchGit all have *optional* hash attrs. This means that we need to be careful with what we allow to avoid accidentally making these defaults. When ‘hash = ""’ we assume the empty hash is wanted.
2020-06-03libutils/hash: remove default encodingzimbatm
This will make it easier to reason about the hash encoding and switch to SRI everywhere where possible.
2020-06-01Merge branch 'derivation-header-include-order' of github.com:Ericson2314/nix ↵Carlo Nucera
into validPathInfo-ca-proper-datatype
2020-05-30Move substitution into Input::fetch()Eelco Dolstra
Closes #3520.
2020-05-30Remove TreeInfoEelco Dolstra
The attributes previously stored in TreeInfo (narHash, revCount, lastModified) are now stored in Input. This makes it less arbitrary what attributes are stored where. As a result, the lock file format has changed. An entry like "info": { "lastModified": 1585405475, "narHash": "sha256-bESW0n4KgPmZ0luxvwJ+UyATrC6iIltVCsGdLiphVeE=" }, "locked": { "owner": "NixOS", "repo": "nixpkgs", "rev": "b88ff468e9850410070d4e0ccd68c7011f15b2be", "type": "github" }, is now stored as "locked": { "owner": "NixOS", "repo": "nixpkgs", "rev": "b88ff468e9850410070d4e0ccd68c7011f15b2be", "type": "github", "lastModified": 1585405475, "narHash": "sha256-bESW0n4KgPmZ0luxvwJ+UyATrC6iIltVCsGdLiphVeE=" }, The 'Input' class is now a dumb set of attributes. All the fetcher implementations subclass InputScheme, not Input. This simplifies the API. Also, fix substitution of flake inputs. This was broken since lazy flake fetching started using fetchTree internally.
2020-05-28Fixing the result of mergeCarlo Nucera
2020-05-28Merge branch 'master' of github.com:NixOS/nix into enum-classCarlo Nucera
2020-05-13formatting and a few minor changesBen Burdette
2020-05-12new pos format for more errorsBen Burdette
2020-05-11Merge branch 'master' into errors-phase-2Ben Burdette
2020-05-08add pos to errorinfo, remove from hintsBen Burdette