Commit graph

15896 commits

Author SHA1 Message Date
John Ericson 8a2da82220
Merge pull request #9759 from obsidiansystems/abs-path-string-view
`absPath`: just take a `std::string_view`
2024-01-15 10:22:20 -05:00
Robert Hensing eeaa188973
Merge pull request #9748 from obsidiansystems/no-rapidcheck-headers
Simplify RapidCheck configure
2024-01-15 14:52:14 +01:00
John Ericson beed00c04e absPath: just take a std::string_view
1. Slightly more efficient

2. Easier to call

Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2024-01-15 08:21:54 -05:00
John Ericson 9b9ecdee34 Simplify RapidCheck configure
No more `RAPIDCHECK_HEADERS`!
2024-01-15 08:05:05 -05:00
John Ericson dd42a4e3e9 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/86501af7f1d51915e6c335f90f2cab73d7704ef3' (2024-01-11)
  → 'github:NixOS/nixpkgs/a1982c92d8980a0114372973cbdfe0a307f1bdea' (2024-01-12)
2024-01-15 08:04:46 -05:00
Robert Hensing 268c49264a
Merge pull request #9763 from L-as/avoid-unnecessary-copy
Avoid unnecessary copy of goal log
2024-01-15 08:32:03 +01:00
John Ericson 8d4b67912d
Merge pull request #9768 from obsidiansystems/nix-profile-test-no-outlink
`tests/functional/nix-profile.sh`: Add missing `--no-link`
2024-01-14 16:11:42 -05:00
John Ericson 03a6ca9b25 tests/functional/nix-profile.sh: Add missing --no-link
Otherwise we get a stray `tests/functional/result`, which can cause
spurious failures later.

(I got a failure because the test temp dir effecting the store dir
changed. This caused a test later because Nix didn't want to remove the
old `result` because it wasn't pointing inside the new Nix store.)
2024-01-14 15:27:44 -05:00
John Ericson 7ab0a4c39d
Merge pull request #9757 from obsidiansystems/parser-dodge-windows-macros
Avoid Windows macros in the parser and lexer
2024-01-14 13:36:13 -05:00
Las Safin f61d951909
Avoid unnecessary copy of goal log
The data was (accidentally?) copied into a std::string,
even though the string is immediately converted into a std::string_view.
The code has been changed to construct a std::string_view directly,
such that one copy less happens.
2024-01-13 19:32:37 +00:00
Qyriad cbd5553d57
doc: provide context in glossary definitions (#9378) 2024-01-13 12:20:08 +01:00
John Ericson e739a5002d Avoid Windows macros in the parser and lexer
`FLOAT`, `INT`, and `IN` are identifers taken by macros.

The name `IN_KW` is chosen to match `OR_KW`, which is presumably named
that way for the same reason of dodging macros.
2024-01-12 19:51:36 -05:00
John Ericson 381df7b9c9
Merge pull request #9756 from obsidiansystems/readline-on-windows
Newer Nixpkgs, get `readline` on Windows
2024-01-12 19:49:50 -05:00
John Ericson dd7e7b0a30 Newer Nixpkgs, get readline on Windows
Now `nix repl` an, in principle, work on that platform too.

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/2c9c58e98243930f8cb70387934daa4bc8b00373' (2023-12-31)
  → 'github:NixOS/nixpkgs/86501af7f1d51915e6c335f90f2cab73d7704ef3' (2024-01-11)
2024-01-12 19:19:21 -05:00
John Ericson 3bc1f8f22f
Merge pull request #9752 from 9999years/hacking-filter-tests
Document unit tests in hacking.md
2024-01-12 19:00:19 -05:00
Rebecca Turner b29be1ff57
Document unit tests in hacking.md 2024-01-12 10:47:49 -08:00
John Ericson c58da62a06
Merge pull request #9737 from obsidiansystems/sys-error-split
Separate `SystemError` from `SysError`
2024-01-12 12:41:36 -05:00
John Ericson 6208ca7209 Separate SystemError from SysError
Most of this is a `catch SysError` -> `catch SystemError` sed. This
is a rather pure-churn change I would like to get out of the way. **The
intersting part is `src/libutil/error.hh`.**

On Unix, we will only throw the `SysError` concrete class, which has
the same constructors that `SystemError` used to have.

On Windows, we will throw `WinError` *and* `SysError`. `WinError`
(which will be created in a later PR), will use a `DWORD` instead of
`int` error value, and `GetLastError()`, which is the Windows equivalent
of the `errno` machinery. Windows will *also* use `SysError` because
Window's "libc" (MSVCRT) implements the POSIX interface, and we use it
too.

As the docs describe, while we *throw* one of the 3 choices above (2
concrete classes or the alias), we should always *catch* `SystemError`.
This ensures no matter how the implementation changes for Windows (e.g.
between `SysError` and `WinError`) the catching logic stays the same
and stays correct.

Co-Authored-By volth <volth@volth.com>
Co-Authored-By Eugene Butler <eugene@eugene4.com>
2024-01-12 12:00:33 -05:00
Eelco Dolstra 52f949bbf5
Merge pull request #9656 from edolstra/nix-profile-stable-names
Make profile element names stable
2024-01-12 16:59:36 +01:00
Eelco Dolstra 72560f7bbe Add profile migration test 2024-01-12 16:33:15 +01:00
Eelco Dolstra 8c7e2ed77c Update release notes 2024-01-12 16:21:07 +01:00
Eelco Dolstra 0d55d660d5
Merge pull request #8043 from bobvanderlinden/pr-shell-env
nix: develop: use SHELL from rc script
2024-01-12 13:42:42 +01:00
Eelco Dolstra e21b3cf9db Merge remote-tracking branch 'origin/master' into nix-profile-stable-names 2024-01-12 13:36:27 +01:00
Robert Hensing be6c86038b
Merge pull request #9606 from 9999years/printer
Support limiting attributes and list items in value printing to support detailed errors
2024-01-12 13:27:56 +01:00
Eelco Dolstra 7c6f093abc .data() -> .c_str() to be on the safe side 2024-01-12 13:00:53 +01:00
Eelco Dolstra 66bd1b0298 Merge remote-tracking branch 'origin/master' into pr-shell-env 2024-01-12 12:56:26 +01:00
Eelco Dolstra cd5fd5cbf3
Merge pull request #9719 from jlesquembre/clang-format-config
Add clang format configuration
2024-01-12 12:19:00 +01:00
Eelco Dolstra 1acb1e0ca3
Merge pull request #9742 from obsidiansystems/mingw-makefiles
More makefile preparations for Windows
2024-01-12 12:11:48 +01:00
John Ericson 90fdbfc601 Build Windows DLLs with -Wl,--export-all-symbols
This is not the most elegant, but will match the SOs in exporting
everything for now. Later we can refine what is public/private to clean
up the interface.
2024-01-11 23:34:37 -05:00
John Ericson af0345df36 makefiles: Do some HOST_CYGWIN -> HOST_WINDOWS
These bits are not Cygwin-specific.
2024-01-11 23:28:11 -05:00
John Ericson 34bb6dcab1 makefiles: Support .exe executable prefix on Windows 2024-01-11 23:28:11 -05:00
Rebecca Turner df84dd4d8d
Restore ambiguous value printer for nix-instantiate
The Nix team has requested that this output format remain unchanged.
I've added a warning to the man page explaining that `nix-instantiate
--eval` output will not parse correctly in many situations.
2024-01-11 16:34:36 -08:00
Rebecca Turner 0fa08b4516
Unify and refactor value printing
Previously, there were two mostly-identical value printers -- one in
`libexpr/eval.cc` (which didn't force values) and one in
`libcmd/repl.cc` (which did force values and also printed ANSI color
codes).

This PR unifies both of these printers into `print.cc` and provides a
`PrintOptions` struct for controlling the output, which allows for
toggling whether values are forced, whether repeated values are tracked,
and whether ANSI color codes are displayed.

Additionally, `PrintOptions` allows tuning the maximum number of
attributes, list items, and bytes in a string that will be displayed;
this makes it ideal for contexts where printing too much output (e.g.
all of Nixpkgs) is distracting. (As requested by @roberth in
https://github.com/NixOS/nix/pull/9554#issuecomment-1845095735)

Please read the tests for example output.

Future work:
- It would be nice to provide this function as a builtin, perhaps
  `builtins.toStringDebug` -- a printing function that never fails would
  be useful when debugging Nix code.
- It would be nice to support customizing `PrintOptions` members on the
  command line, e.g. `--option to-string-max-attrs 1000`.
2024-01-11 16:34:36 -08:00
Rebecca Turner c9125603a5
Unindent print.hh declarations 2024-01-11 16:07:01 -08:00
John Ericson a38e6b9087
Merge pull request #9745 from obsidiansystems/fix-install-unit-tests-cond
packages.nix: Fix `installUnitTests` condition
2024-01-11 17:11:27 -05:00
John Ericson a923444a94 packages.nix: Fix installUnitTests condition
The intent was we install the tests when we can *not* run them. Instead,
we were installing them when we can.
2024-01-11 16:39:56 -05:00
John Ericson 84502674f8
Merge pull request #9736 from obsidiansystems/mingw-makefiles
Some small Makefile improvements to prepare for Windows support
2024-01-11 10:58:55 -05:00
John Ericson 113499d16f
Merge pull request #9634 from 9999years/combine-abstract-pos-and-pos
Combine `AbstractPos`, `PosAdapter`, and `Pos`
2024-01-11 10:47:27 -05:00
John Ericson 423484ad26 Only link with -pthread on Unix
We don't want this with MinGW.
2024-01-10 20:38:39 -05:00
John Ericson f9e5eb5f0a Make indentation in makesfiles consistent
Tab (as required) for rules, two spaces for `if`...`endif`.
2024-01-10 20:26:34 -05:00
John Ericson 57dc4fc878 Make more expressive HOST_* macro system 2024-01-10 20:14:55 -05:00
John Ericson 75d509eb08
Merge pull request #9731 from obsidiansystems/better-test-no-gc
Improve the build without GC
2024-01-10 10:19:30 -05:00
John Ericson 0c3ce23754 Improve the build without GC
We don't just want to pass `--enable-gc=no`; we also want to make sure
boehmgc is not a dependency. Creating a nix-level configuration option
to do both, and then using that for the CI job, is more robust.
2024-01-09 17:48:50 -05:00
John Ericson 84aa8e9f19
Merge pull request #9728 from obsidiansystems/readline-support
Improve build sytem support for readline instead of editline
2024-01-09 17:23:02 -05:00
John Ericson 2cea88dbc8 Improve build sytem support for readline instead of editline
Changes:

- CPP variable is now `USE_READLINE` not `READLINE`

- `configure.ac` supports with new CLI flag

- `package.nix` supports with new configuration option

- `flake.nix` CIs this (along with no markdown)

Remove old Ubuntu 16.04 stop-gap too, as that is now quite old.

Motivation:

- editline does not build for Windows, but readline *should*. (I am
  still working on this in Nixpkgs at this time, however. So there will
  be a follow-up Nix PR removing the windows-only skipping of the
  readline library once I am done.)

- Per
  https://salsa.debian.org/debian/nix/-/blob/master/debian/rules?ref_type=heads#L27
  and #2551, Debian builds Nix with readline. Now we better support and
  CI that build configuration.

This is picking up where #2551 left off, ensuring we test a few more
things not merely have CPP for them.

Co-authored-by: Weijia Wang <9713184+wegank@users.noreply.github.com>
2024-01-09 16:56:55 -05:00
Eelco Dolstra b91c935c2f
Merge pull request #9648 from cole-h/nix-shell-ordering
nix shell: reflect command line order in PATH order
2024-01-09 19:00:33 +01:00
Eelco Dolstra 47633ceec3
Merge pull request #9726 from DavHau/gitignore
gitignore: add result-*
2024-01-09 16:55:14 +01:00
DavHau 3d9e0c60e4 gitignore: add result-* 2024-01-09 18:36:09 +07:00
John Ericson 15820a0507
Merge pull request #9720 from NixOS/fix-internal-api-docs
Fix Internal API docs
2024-01-08 16:33:38 -05:00
John Ericson fa2a27d720
Merge pull request #9710 from wegank/disable-lowdown
Make lowdown optional
2024-01-08 15:13:45 -05:00