Commit graph

18115 commits

Author SHA1 Message Date
John Ericson
59def6c23b
Merge pull request #11178 from obsidiansystems/better-exe-lookup
Move `NIX_BIN_DIR` and all logic using it to the Nix executable itself
2024-08-12 12:21:56 -05:00
John Ericson
58b03ef1cd Move NIX_BIN_DIR and all logic using it to the Nix executable itself
This is because with the split packages of the Meson build, we simply
have no idea what directory the binaries will be installed in when we
build the library.

In the process of doing so, consolidate and make more sophisticated the
logic to cope with a few corner cases (e.g. `NIX_BIN_DIR` exists, but no
binaries are inside it).

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-12 12:29:17 -04: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
Robert Hensing
3cc2e2a0ac
Edit docs 2024-08-11 03:31:44 +02:00
John Ericson
cfe66dbec3
Merge pull request #11218 from obsidiansystems/better-executable-path
Factor out `lookupExecutable` and other PATH improvements
2024-08-07 23:21:19 -05:00
John Ericson
0646b6cd61
Update comments / documentation.
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-07 22:29:56 -05:00
John Ericson
6c861b9c51 Factor out lookupExecutable and other PATH improvments
This ended up motivating a good deal of other infra improvements in
order to get Windows right:

- `OsString` to complement `std::filesystem::path`

- env var code for working with the underlying `OsString`s

- Rename `PATHNG_LITERAL` to `OS_STR`

- `NativePathTrait` renamed to `OsPathTrait`, given a character template
  parameter until #9205 is complete.

Split `tests.cc` matching split of `util.{cc,hh}` last year.

Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-08-07 18:12:58 -04:00
tomberek
0836888002
Merge pull request #11233 from rhendric/rhendric/reference-manual-2
docs: add language/string-literals.md
2024-08-07 16:17:16 -04:00
tomberek
7354681804
Merge branch 'master' into rhendric/reference-manual-2 2024-08-07 15:25:02 -04:00
Eelco Dolstra
2ed075ffc0
Merge pull request #11257 from DeterminateSystems/no-failed-substitution
PathSubstitutionGoal: Fix spurious "failed" count in the progress bar
2024-08-06 10:33:26 +02:00
John Ericson
79abf816b9
Merge pull request #11256 from obsidiansystems/test-organize
Split tests, organize more string functions
2024-08-05 12:44:39 -05:00
Eelco Dolstra
0a00bd07b2 PathSubstitutionGoal: Fix spurious "failed" count in the progress bar
It is not an error if queryPathInfo() indicates that a path does not
exist in the substituter.

Fixes #11198. This was broken in 846869da0e.
2024-08-05 18:56:02 +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
John Ericson
1fce591cbc
Merge pull request #11255 from DeterminateSystems/test-s3-binary-cache-store
Add a VM test for S3BinaryCacheStore
2024-08-05 11:12:08 -05:00
Eelco Dolstra
2950f9e18a Add a VM test for S3BinaryCacheStore
Fixes #11238.
2024-08-05 11:48:50 +02:00
a-kenji
5a6e28e166
docs: installable remove alternate expression flag (#11254) 2024-08-04 23:03:21 +00: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
09199a40cd
Merge pull request #11244 from Mic92/make-c-backwards-compat
allow to c api with older c versions
2024-08-02 12:30:43 -05:00
Jörg Thalheim
739418504c allow to c api with older c versions
In the FFI world we have many tools that are not gcc/clang and therefore
not always support the latest C standard. This fixes support with cffi
i.e. used in https://github.com/tweag/python-nix
2024-08-02 17:19:45 +02:00
Eelco Dolstra
838b666a80
Merge pull request #11237 from DeterminateSystems/fix-s3-store
Fix the S3 store
2024-08-01 17:46:29 +02:00
Eelco Dolstra
9b5b7b7963 Fix the S3 store
It was failing with:

   error: AWS error fetching 'nix-cache-info': The specified bucket does not exist

because `S3BinaryCacheStoreImpl` had a `bucketName` field that
shadowed the inherited `bucketName from `S3BinaryCacheStoreConfig`.
2024-08-01 16:51:57 +02:00
Eelco Dolstra
854346045a
Merge pull request #11236 from edolstra/bump-2.25.0
Bump version
2024-08-01 11:33:48 +02:00
Eelco Dolstra
2edc570e3e
Merge pull request #11235 from edolstra/fix-release-script
Fix the release script
2024-08-01 11:33:22 +02:00
Ryan Hendrickson
b291b61089
docs: editorial quibbles (#11232) 2024-08-01 11:14:49 +02:00
Eelco Dolstra
30aca6f243 Bump version 2024-08-01 10:43:00 +02:00
Eelco Dolstra
617e711820 'build' is now 'build.nix' 2024-08-01 10:41:42 +02:00
Ryan Hendrickson
17318bc70d docs: fix string literal example formatting 2024-07-31 19:22:17 -04:00
Ryan Hendrickson
9e8afc68e5 docs: add language/string-literals.md 2024-07-31 19:07:57 -04:00
Ryan Hendrickson
6ed67d35ed
docs: add variables; rework scope (#11062)
Co-authored-by: Valentin Gagarin <valentin@gagarin.work>
2024-07-31 21:39:43 +00:00
Eelco Dolstra
b24757f08a
Merge pull request #11231 from DeterminateSystems/release-notes
2.24 release notes
2024-07-31 23:24:39 +02:00
Eelco Dolstra
794a50065b base32 -> nix32 2024-07-31 22:33:41 +02:00
Qyriad
cb5a5dd4f3 docs: clarify how ^ works for -E/-f installables
We didn't even realize you *could* use this syntax with -E and -f, much
less that the attribute path could be *empty*.

Change-Id: Id1a6715609f3a76a5ce477bd43a7832effbbe07b
2024-07-31 22:27:58 +02:00
Qyriad
8ff169715d docs: clarify how the different kinds of installables are selected
Change-Id: I146736bb97ebe035e04be69ce9fb60a557e38c6c
2024-07-31 22:27:58 +02:00
Eelco Dolstra
f136ec5290 Add contributors 2024-07-31 22:16:44 +02:00
Eelco Dolstra
22ad0e653f Edit release notes 2024-07-31 22:14:27 +02:00
John Ericson
733c816d34
Small windows cross fixes (#11230) 2024-07-31 20:04:18 +00:00
Eelco Dolstra
c952d933e5 release notes: 2.24.0 2024-07-31 21:57:31 +02: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
Eelco Dolstra
e8b37e9e70
Merge pull request #11220 from NixOS/release-credits
Credit all contributors in release notes
2024-07-31 21:12:03 +02:00
Eelco Dolstra
ed0934b884
Merge pull request #11140 from DeterminateSystems/protocol-features
WorkerProto: Support fine-grained protocol feature negotiation
2024-07-31 17:47:38 +02:00
Eelco Dolstra
69fb2848a5
Merge pull request #11170 from NixOS/release-notes-2.24
Release notes for 2.24
2024-07-31 17:06:49 +02:00
tomberek
4c007bf88f
Merge pull request #11216 from tomberek/tomberek.add_flake_headers
fix: add flake headers
2024-07-30 21:19:14 -04:00
Jade Lovelace
5878b1475f doc: release notes for banning integer overflow
Change-Id: Ib75ab5b8b4d879035d7ee7678f9cd0c491a39c0a
2024-07-30 18:13:05 -07:00
Jade Lovelace
bf050d9e96 docs: update to define integer overflow
Change-Id: Ie8a1b31035f2d27a220e5df2e9e178ec3b39ee68
2024-07-30 18:13:05 -07: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
e28cb67d41 libutil: add checked arithmetic tools
This is in preparation for adding checked arithmetic to the evaluator.

Change-Id: I6e115ce8f5411feda1706624977a4dcd5efd4d13
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
Tom Bereknyei
ef80217448 fix: add flake headers 2024-07-30 13:19:55 -04:00
Robert Hensing
f011cfd28d maintainers/release-*: Add mode line
This lets various tools figure out the language more easily.
2024-07-30 17:54:37 +02:00
Corbin Simpson
ee86e7f361
doc/command-ref/nix-shell: Shebangs can occur anywhere (#11202)
Co-authored-by: Valentin Gagarin <valentin@gagarin.work>
2024-07-30 12:51:47 +00:00