Commit graph

15881 commits

Author SHA1 Message Date
Rebecca Turner
2d96c7a51f
Remove outdated reference to y in nix-instantiate man page 2024-01-12 11:27:31 -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
John Ericson
29eb5ed1dc Fix Internal API docs
Because of source filtering, they were empty.

Fixes #9694
2024-01-08 14:47:42 -05:00
Weijia Wang
bbd0a959e1 Make lowdown optional
Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2024-01-08 20:37:42 +01:00
Rebecca Turner
4feb7d9f71
Combine AbstractPos, PosAdapter, and Pos
Also move `SourcePath` into `libutil`.

These changes allow `error.hh` and `error.cc` to access source path and
position information, which we can use to produce better error messages
(for example, we could consider omitting filenames when two or more
consecutive stack frames originate from the same file).
2024-01-08 10:59:41 -08:00
José Luis Lafuente
53fdcbca50
Add clang format configuration 2024-01-08 19:46:38 +01:00
Valentin Gagarin
6a243e5ed2
fix an old lost direct (#9458)
this part must have been moved quite a while ago, but apparently so far
no one noticed
2024-01-08 19:38:36 +01:00
John Ericson
3ecdda80be
Merge pull request #9709 from wegank/configure-ac-doc-gen
Fix typo in configure.ac
2024-01-08 12:19:36 -05:00
Weijia Wang
605eba3829 Fix typo in configure.ac 2024-01-08 17:31:27 +01:00
John Ericson
ff6de4a9ee
Merge pull request #9662 from shlevy/flat-fixed-references-assert
Improve error message for fixed-outputs with references.
2024-01-08 10:46:37 -05:00
John Ericson
c4c636284e
Only test bug fix with new enough deamon 2024-01-08 10:17:28 -05:00
Shea Levy
eeb2f083c5
Improve error message for fixed-outputs with references.
This codepath is possible, e.g. with a dockerTools.pullImage of an image with a Nix store.
2024-01-07 07:32:31 -05:00
Valentin Gagarin
8e865f3aba
deduplicate installation instructions (#9507)
* deduplicate installation instructions

- reorder sections to present pinned installation more prominently
- remove outdated notes on the macOS installer rework
- update instructions to handle the installer tarball

Co-authored-by: Travis A. Everett <travis.a.everett@gmail.com>
2024-01-06 22:45:25 +01:00
wiki-me
a4d33e816e
Improve documentation around upgrading nix (#9679)
* Improve documentation around upgrading nix, add replacing nix channel with new one

Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2024-01-06 18:01:10 +00:00
John Ericson
9651034dc2
Merge pull request #9698 from NixOS/no-boost-regex
Don't pull in libboost_regex
2024-01-05 09:49:13 -05:00
Eelco Dolstra
388c79d546 Don't pull in libboost_regex
We're not using and we don't want to pull in libicu (37 MiB).
2024-01-05 15:17:01 +01:00
Eelco Dolstra
359990dfdc
Merge pull request #9324 from 9999years/fix-8854-take-2
Don't attempt to `git add` ignored files
2024-01-05 14:57:32 +01:00