1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00
Commit graph

3081 commits

Author SHA1 Message Date
John Ericson a97a08411c More support for std::filepath in libnixutil
We're not replacing `Path` in exposed definitions in many cases, but
just adding alternatives. This will allow us to "top down" change `Path`
to `std::fileysystem::path`, and then we can remove the `Path`-using
utilities which will become unused.

Also add some test files which we forgot to include in the libutil unit
tests `meson.build`.

Co-Authored-By: siddhantCodes <siddhantk232@gmail.com>
2024-08-26 17:23:56 -04:00
Robert Hensing 88998fae74
Merge pull request #11304 from hercules-ci/repl-doc-functor
`:doc`: support `__functor`
2024-08-26 17:20:37 +02:00
Robert Hensing 77ddcbe12e
getDoc: Explain why we partially apply __functor 2024-08-26 16:15:13 +02:00
Eelco Dolstra 257470b58d Merge remote-tracking branch 'origin/master' into flip-coroutines 2024-08-20 17:19:17 +02:00
tomberek 1ff0a983d6
Merge pull request #11322 from NixOS/eval-cache-doc
doc: Manage expectations for eval-cache
2024-08-19 13:50:15 -04:00
Robert Hensing b52e58903e doc: Manage expectations for eval-cache
Incorrectly high expectations lead to frustration for users who
stick around to experience how useless it is for e.g. a devShell

https://functional.cafe/@arianvp/112976284363120036:

> Flakes doesn't have eval caching. It has command line argument
> caching. It literally just stores the cli argument you passed
> in a sqlite database and yes that's as useless as it sounds

> When I discovered flakes had no expression level caching whatsoever
> I kind of felt lied to and betrayed.
2024-08-19 16:52:36 +02:00
tomberek 92df2a7cb2
Merge pull request #11285 from DeterminateSystems/downloadTarball-cacheable
fetchers::downloadTarball(): Return a cacheable accessor
2024-08-16 23:05:49 -04:00
Robert Hensing 72a4d1f52d Add :doc support for __functor 2024-08-15 13:04:34 +02:00
Robert Hensing 6068e32aa7 refactor: Extract EvalState::addCallDepth 2024-08-15 13:04:34 +02:00
Robert Hensing 622c402659
Merge pull request #11292 from tomberek/tomberek.symbolstring
fix: use SymbolStr in constructor
2024-08-13 23:57:59 +02:00
Valentin Gagarin 4956e7c44c
add cross-references to nix-path overriding (#11288)
* add cross-references to `nix-path` overriding

while this information is already present in the settings, it's more
likely to be first accessed through the "lookup path" page, which
currently requires following two links to get to the practically
important bits.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-13 19:22:32 +02:00
Tom Bereknyei f22bf867eb fix: use SymbolStr in constructor 2024-08-12 22:18:14 -04:00
Eelco Dolstra 9f6ee93f48 fetchers::downloadTarball(): Return a cacheable accessor
downloadTarball() is used by `-I foo=<url>` etc. fetchToStore() needs
the accessor to have a fingerprint to enable caching.

Fixes #11271.
2024-08-12 15:48:26 +02:00
Robert Hensing 18485d2d53
Merge pull request #11188 from lf-/jade/kill-int-overflow
Ban integer overflow in the Nix language
2024-08-11 04:24:16 +02:00
John Ericson 9d2d4d11e6 Split tests, organize more string functions
The test split matches PR #8920, so the utility files and tests files
are once again to 1-1. The string changes continues what was started in
PR #11093.
2024-08-05 12:50:13 -04:00
tomberek ea1f87ecda
Merge pull request #11145 from rhendric/rhendric/parser-lalr
Make parser LALR, conflict-free
2024-08-04 03:59:10 -04:00
John Ericson 733c816d34
Small windows cross fixes (#11230) 2024-07-31 20:04:18 +00:00
Valentin Gagarin db5bacb637
reword documentation on nix-path config option (#7772)
* docs: unify documentation on search paths

- put all the information on search path semantics into `builtins.findFile`
- put all the information on determining the value of `builtins.nixPath` into the
  `nix-path` setting

  maybe `builtins.nixPath` is a better place for this, but those bits
  can still be moved around now that it's all next to each other.
- link to the syntax page for lookup paths from all places that are
  concerned with it
- add or clarify examples
- add a test verifying a claim from documentation
2024-07-31 21:41:26 +02:00
Jade Lovelace 7b6622d733 language: cleanly ban integer overflows
This also bans various sneaking of negative numbers from the language
into unsuspecting builtins as was exposed while auditing the
consequences of changing the Nix language integer type to a newtype.

It's unlikely that this change comprehensively ensures correctness when
passing integers out of the Nix language and we should probably add a
checked-narrowing function or something similar, but that's out of scope
for the immediate change.

During the development of this I found a few fun facts about the
language:
- You could overflow integers by converting from unsigned JSON values.
- You could overflow unsigned integers by converting negative numbers
  into them when going into Nix config, into fetchTree, and into flake
  inputs.

  The flake inputs and Nix config cannot actually be tested properly
  since they both ban thunks, however, we put in checks anyway because
  it's possible these could somehow be used to do such shenanigans some
  other way.

Note that Lix has banned Nix language integer overflows since the very
first public beta, but threw a SIGILL about them because we run with
-fsanitize=signed-overflow -fsanitize-undefined-trap-on-error in
production builds. Since the Nix language uses signed integers, overflow
was simply undefined behaviour, and since we defined that to trap, it
did.

Trapping on it was a bad UX, but we didn't even entirely notice
that we had done this at all until it was reported as a bug a couple of
months later (which is, to be fair, that flag working as intended), and
it's got enough production time that, aside from code that is IMHO buggy
(and which is, in any case, not in nixpkgs) such as
https://git.lix.systems/lix-project/lix/issues/445, we don't think
anyone doing anything reasonable actually depends on wrapping overflow.

Even for weird use cases such as doing funny bit crimes, it doesn't make
sense IMO to have wrapping behaviour, since two's complement arithmetic
overflow behaviour is so *aggressively* not what you want for *any* kind
of mathematics/algorithms. The Nix language exists for package
management, a domain where bit crimes are already only dubiously in
scope to begin with, and it makes a lot more sense for that domain for
the integers to never lose precision, either by throwing errors if they
would, or by being arbitrary-precision.

Fixes: https://github.com/NixOS/nix/issues/10968
Original-CL: https://gerrit.lix.systems/c/lix/+/1596

Change-Id: I51f253840c4af2ea5422b8a420aa5fafbf8fae75
2024-07-30 18:13:05 -07:00
Jade Lovelace dd75711895 Use std::strong_ordering for version comparison
The actual motive here is the avoidance of integer overflow if we were
to make these use checked NixInts and retain the subtraction.

However, the actual *intent* of this code is a three-way comparison,
which can be done with operator<=>, so we should just do *that* instead.

Change-Id: I7f9a7da1f3176424b528af6d1b4f1591e4ab26bf
2024-07-30 18:13:05 -07:00
John Ericson 12717325cc Make sure we use -isystem with Meson on some deps
Otherwise we get warnings on external code.
2024-07-29 13:06:26 -04:00
Eelco Dolstra 0b96c586e0
Merge pull request #11195 from DeterminateSystems/tarball-roots
Improve handling of tarballs that don't consist of a single top-level directory
2024-07-29 16:58:59 +02:00
Eelco Dolstra f9d55b4d51
Merge pull request #11191 from DeterminateSystems/hash-symbol
Use std::unordered_map for ValueMap
2024-07-29 15:30:37 +02:00
Eelco Dolstra 71865dee2d Fix fetchTarball docs 2024-07-29 15:04:55 +02:00
Robert Hensing 861bd102a6
Merge pull request #11167 from NixOS/repl-test-rejiggle
Fix repl test for `buildReadlineNoMarkdown`
2024-07-27 00:55:57 +02:00
Eelco Dolstra b88950ec77 Update fetchTree docs 2024-07-26 20:34:04 +02:00
Eelco Dolstra 6d843ce9fe Provide std::hash<Symbol> 2024-07-26 16:06:09 +02:00
Ryan Hendrickson 18db46a6cb parser.y: GLR -> LALR 2024-07-25 15:48:58 -04:00
Ryan Hendrickson 6e3b9e6a4d parser.y: eliminate conflicts 2024-07-25 15:48:58 -04:00
Ryan Hendrickson b0a8430e85 parser.y: move attr doc setting into addAttr 2024-07-25 15:48:58 -04:00
Ryan Hendrickson 429a197d24 parser.y: use names where I'll be refactoring 2024-07-25 15:48:58 -04:00
Robert Hensing 6ec123ad6b
Merge pull request #11131 from rhendric/rhendric/pipe-operators
libexpr: experimental pipe operators
2024-07-25 16:58:43 +02:00
Eelco Dolstra 99c20d6624
Merge pull request #11179 from obsidiansystems/misc-fix
Misc fixes
2024-07-25 14:01:54 +02:00
Jörg Thalheim 63e50a4b56 add werror=suggest-override
Improves code readability by making overrides explicit.
Inspired by lix code-base
2024-07-25 07:41:12 +02:00
John Ericson 90f7f2139e
Merge pull request #11115 from NixOS/doc-derivation
Document builtins.derivation
2024-07-25 00:21:53 -04:00
John Ericson 1ae5738317 Fix some warnings
I think they came from the last Nixpkgs bump.
2024-07-25 00:02:43 -04:00
John Ericson 3b49f7a143
Deduplicate our many package.nix a bit (#11175)
- They should all be built in parallel

- They should all use strict deps by default
2024-07-25 03:12:39 +00:00
Valentin Gagarin a2fed6db9e
manual: Contributing -> Development, Hacking -> Building (#9014)
* manual: Contributing -> Development, Hacking -> Building

what's currently called "hacking" are really instructions for setting up
a development environment and compiling from source. we have
a contribution guide in the repo (which rightly focuses on GitHub
workflows), and the material in the manual is more about working
on the code itself.

since we'd otherwise have three headings that amount to "Building Nix",
this change also moves the "classic Nix" instructions to the top.

we may want to reorganise this in the future, and bring
contributor-oriented information closer to the code, but for now let's
stick to more accurate names to ease navigation.
2024-07-25 02:53:06 +00:00
Valentin Gagarin e062021314
fix NIX_PATH for real (#11079)
* fix NIX_PATH overriding

- test restricted evaluation
- test precedence for setting the search path

Co-authored-by: Robert Hensing <robert@roberthensing.nl>
Co-authored-by: John Ericson <git@JohnEricson.me>
2024-07-24 21:17:15 +00:00
Ryan Hendrickson e086d5d899 libexpr: experimental pipe operators 2024-07-24 13:17:28 -04:00
Robert Hensing 3172e88af5 Make abort() call sites log first 2024-07-24 16:52:04 +02:00
Eelco Dolstra ca0f7db843 Remove hacks to support evaluation from coroutines
Since we're not doing this anymore.
2024-07-24 16:43:25 +02:00
Robert Hensing 68693276f9 Update fixupBoehmStackPointer doc
lo might have made sense in the bdwgc code, maybe?, but not here.
2024-07-24 13:02:49 +02:00
Robert Hensing 907b0a371a Rename osStackLow -> osStackLimit
This is in accordance with ARM's naming convention.
"Low" is confusing, because it could refer to either the cold end
of the stack as an abstract data type, or a low address.
These are different places, because the stack grows down through
the address space.
2024-07-24 13:02:49 +02:00
Robert Hensing 7d4d34a27d eval-gc.cc: Fix warning 2024-07-24 12:48:38 +02:00
Robert Hensing 5d6bc484be Hide getGCCycles when we have no GC
Alternatively, we could make it return 0, but we don't need it in
the first place because the caller exists conditionally too.
2024-07-23 16:24:43 +02:00
Robert Hensing eb89e50cbb Rejiggle getGCCycles() for buildNoGc 2024-07-23 16:21:43 +02:00
Eelco Dolstra babfd0cd99
Merge pull request #11150 from hercules-ci/issue-11141-broken-sp-corrector
Fix issue #11141 broken stack pointer corrector
2024-07-22 19:59:46 +02:00
Eelco Dolstra d08bb025e1
Merge pull request #11043 from hercules-ci/assert-eq
`assert`: Report why values aren't equal
2024-07-22 17:34:28 +02:00
Eelco Dolstra 56a2f7ab1d
Merge pull request #11102 from fzakaria/issue-10532
doc: Add comment for fetchurl for name & url
2024-07-22 15:49:41 +02:00