Robert Hensing
12ec3154b8
Merge pull request #8699 from tweag/nix-c-bindings
...
(Towards) stable C bindings for libutil, libexpr
2024-04-04 17:50:52 +02:00
HaeNoe
50cb14fcf9
Improve checked json casting ( #10087 )
...
This introduces new utility functions to get elements from JSON — in an ergonomic way and with nice error messages if the expected type does not match.
Co-authored-by: John Ericson <John.Ericson@Obsidian.Systems>
2024-04-03 18:04:00 +00:00
Eelco Dolstra
09551fabd0
Handle the case where a parent of ~/.nix-defexpr is a symlink
...
Fixes https://github.com/DeterminateSystems/nix-installer/issues/912 and probably #10247 .
2024-04-03 16:46:23 +02:00
John Ericson
02fa20622f
Start factoring out Unix assumptions
...
This splits files and adds new identifiers in preperation for supporting
windows, but no Windows-specific code is actually added yet.
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2024-04-02 14:43:38 -04:00
John Ericson
852391765d
Add unix (and linux) dirs
...
In the Nix commit, platform-specific sources will go here.
2024-04-02 12:55:23 -04:00
Théophane Hufschmitt
290be6c906
Merge pull request #10345 from edolstra/fix-chroot-flakes
...
Fix flake evaluation in chroot stores
2024-04-02 17:49:45 +02:00
Théophane Hufschmitt
29c3e4f580
Merge pull request #10340 from edolstra/trust-github
...
Add trust-tarballs-from-git-forges setting
2024-04-02 16:08:57 +02:00
Eelco Dolstra
bb5764e578
Merge pull request #10301 from a-n-n-a-l-e-e/wal-persist
...
enable persistent WAL mode for sqlite db
2024-04-02 12:02:12 +02:00
Eelco Dolstra
911febe56c
Merge pull request #10358 from yshui/fix-include
...
Fix "include" directive in config file
2024-04-02 11:50:12 +02:00
John Ericson
9b88e52846
Merge pull request #10362 from obsidiansystems/maybeLstat
...
Factor out `nix::maybeLstat`
2024-03-30 11:23:29 -04:00
John Ericson
3752bbef28
Document maybeLstat
...
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2024-03-30 10:39:25 -04:00
Théophane Hufschmitt
845b2a9256
Merge pull request #10363 from obsidiansystems/is-root-user
...
Factor out `isRootUser` function
2024-03-30 07:15:56 +01:00
Théophane Hufschmitt
c864e3b871
Merge pull request #10341 from xokdvium/xokdvium/fix-double-decompression
...
fix(libutil): apply only the specified filter to decompress archive
2024-03-30 07:13:09 +01:00
Sergei Zimmerman
500683a949
fix(libutil): apply only the specified filter to decompress archive
...
This patch makes `makeDecompressionSink` strip only a single layer
of compression specified via method. This fixes erroneous decompression
of doubly-compressed NARs fetched with curl.
2024-03-30 01:29:29 +03:00
Sergei Zimmerman
6d9bafb3b8
nfc(libutil): reformat files
...
Run clang-format on compression.{cc,hh} and tarfile{cc,hh}.
This way follow-up patches will be formatted properly and have
easier to read diffs.
2024-03-30 01:29:22 +03:00
John Ericson
e4d9b207c2
Factor out isRootUser
function
2024-03-29 16:33:01 -04:00
John Ericson
8be347afca
Factor out nix::maybeLstat
...
This function is nice for more than `PosixSourceAccessor`. We can make a
few things simpler with it.
Note that the error logic slightly changes in some of the call sites, in
that we also count `ENOTDIR` and not just `ENOENT` as not having the
file, but that should be fine.
2024-03-29 16:32:53 -04:00
John Ericson
555181c3fd
throwExceptionSelfCheck
throw Error
...
`SysError` is not appropriate because there is no (Unix) syscall involved.
The catch block in `initLibUtil` is already for `Error` and still works.
2024-03-29 16:05:05 -04:00
Yuxuan Shui
0be87c023f
Fix "include" directive in config files
2024-03-29 16:33:13 +00:00
Théophane Hufschmitt
b72e1c79da
Merge pull request #10299 from detroyejr/remove-repl-flake
...
flakes: remove experimental repl-flake
2024-03-29 15:06:23 +01:00
José Luis Lafuente
926fbadcc3
C API: add more tests
2024-03-29 14:00:19 +01:00
Eelco Dolstra
46d9e70c20
Add trust-tarballs-from-git-forges setting
...
If enabled, GitHub flakerefs don't require a content hash, a Git
revision is enough.
Fixes #10297 .
2024-03-29 13:38:47 +01:00
Théophane Hufschmitt
90f5189451
Merge pull request #10131 from intelfx/work/notty
...
`TERM=dumb` fixes
2024-03-29 13:38:37 +01:00
José Luis Lafuente
2bb609bce2
C API: rename nix_observe_string -> nix_get_string_callback
2024-03-29 10:01:16 +01:00
Théophane Hufschmitt
de101417eb
Merge pull request #10305 from hercules-ci/addErrorContext-is-great
...
Always print addErrorContext
2024-03-29 09:10:09 +01:00
Robert Hensing
ef26133df3
Merge pull request #10337 from Cyclic4179/patch-1
...
`nix shell` shebang: support O'Caml comments
2024-03-28 19:54:03 +01:00
José Luis Lafuente
061140fc8f
C API: remove unused argument
2024-03-28 19:38:12 +01:00
José Luis Lafuente
925a8fda6e
C API: Use new ListBuilder helper
...
See https://github.com/NixOS/nix/pull/10251
2024-03-28 19:02:01 +01:00
José Luis Lafuente
c57de60522
C API: Keep the structure flat
...
See https://github.com/NixOS/nix/pull/10329
2024-03-28 19:00:04 +01:00
José Luis Lafuente
d96b52bd8b
C api: nix_export_std_string -> nix_observe_string
2024-03-28 10:52:02 +01:00
José Luis Lafuente
31fbb24329
C API: refactor nix_store_realise
2024-03-28 10:52:02 +01:00
José Luis Lafuente
1a574c6c60
C API: refactor ListBuilder
2024-03-28 10:52:01 +01:00
José Luis Lafuente
34d15e8f2f
C API: rename nix_store_build -> nix_store_realise
2024-03-28 10:52:01 +01:00
José Luis Lafuente
1093ab64a2
C API: add more tests
2024-03-28 10:52:01 +01:00
José Luis Lafuente
c49b88b066
C API: update docs based on PR feedback
2024-03-28 10:52:01 +01:00
José Luis Lafuente
7c602d9f01
C API: add tests for external values
2024-03-28 10:52:01 +01:00
José Luis Lafuente
2349185c96
C API: fix after rebase
2024-03-28 10:52:00 +01:00
José Luis Lafuente
6c231dcf68
C API: disable test
2024-03-28 10:52:00 +01:00
José Luis Lafuente
24c8f6864d
C API: if store doesn't have a version, return an empty string
2024-03-28 10:52:00 +01:00
José Luis Lafuente
dfdb90dc8e
C API: Consolidate initializers
2024-03-28 10:52:00 +01:00
José Luis Lafuente
415583a500
C API: use bool argument consistently
2024-03-28 10:52:00 +01:00
José Luis Lafuente
d5ec1d0617
C API: nix_store_open, check for empty strings
2024-03-28 10:51:59 +01:00
José Luis Lafuente
535694122e
C API: rename State to EvalState
2024-03-28 10:51:59 +01:00
José Luis Lafuente
24604d024a
C API: fix docs build after rebase
2024-03-28 10:51:59 +01:00
José Luis Lafuente
41f1669dea
C API: add tests for libutil and libstore
2024-03-28 10:50:02 +01:00
José Luis Lafuente
46f5d0ee7b
Apply suggestions from code review
2024-03-28 10:47:56 +01:00
José Luis Lafuente
550af113c6
String value refactor
...
Related to https://github.com/NixOS/nix/pull/9047
2024-03-28 10:47:56 +01:00
Yorick van Pelt
c6e28d8da2
C API: fix: macos doesn't have std::bind_front
2024-03-28 10:47:56 +01:00
Yorick van Pelt
ab9250286a
C API: add a way to throw errors from primops
2024-03-28 10:47:56 +01:00
Yorick van Pelt
3d79f38709
C API: add user_data argument to nix_alloc_primop
...
Also add a helper function for primops, that converts to C argument
types
(and eventually handles errors)
2024-03-28 10:47:55 +01:00
Yorick van Pelt
48aa57549d
primops: change to std::function, allowing the passing of user data
2024-03-28 10:47:55 +01:00
Yorick van Pelt
9e423dee11
C API: update after rebase
2024-03-28 10:47:55 +01:00
Yorick van Pelt
e1bb799da9
C API: reformat according to proposed clang-format file
2024-03-28 10:47:55 +01:00
Yorick van Pelt
9d380c0f76
C API: clarify some documentation
2024-03-28 10:47:55 +01:00
Yorick van Pelt
5d82d6e733
nix_api: fix missing includes in headers
...
Forward declaration doesn't work here, since we define classes that
contain the objects
2024-03-28 10:47:55 +01:00
Yorick
40f5d48d3c
Apply documentation suggestions from code review
...
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2024-03-28 10:47:55 +01:00
Yorick van Pelt
e642bbc2a7
C API: move to src/lib*/c/
2024-03-28 10:46:39 +01:00
Yorick van Pelt
df9401eb4e
nix_api_store: add nix_init_plugins
2024-03-28 10:39:07 +01:00
Yorick van Pelt
dc0f7d8f96
initPlugins: run nix_plugin_entry() on dlopen'd plugins
...
Only when it exists.
2024-03-28 10:39:07 +01:00
Yorick van Pelt
713f10aeaa
nix_api_value: Add nix_register_primop to add builtins
2024-03-28 10:39:07 +01:00
Yorick van Pelt
e891aac2e4
nix_api_value: add nix_get_attr_name_byidx get attr names without forcing
2024-03-28 10:39:07 +01:00
Yorick van Pelt
9cccb8bae0
nix_api_expr: always force values before giving them to the user
2024-03-28 10:39:07 +01:00
Yorick van Pelt
f0afe7f9b9
nix_api_util: throw nix::error instead of new nix::Error for null ctx's
2024-03-28 10:39:06 +01:00
Yorick van Pelt
e74d6c1b3d
nix_api_expr: document nix_value_force
2024-03-28 10:39:06 +01:00
Yorick van Pelt
e58a9384c6
nix_api_expr, nix_api_util: slightly improve documentation
2024-03-28 10:39:06 +01:00
Yorick van Pelt
f41a7e326b
nix_err_code: do not fail
2024-03-28 10:39:06 +01:00
Yorick van Pelt
b0741f7128
external-api-doc: introduce and improve documentation
2024-03-28 10:39:06 +01:00
Yorick van Pelt
866558af34
nix_api_expr: add error handling to incref, decref
2024-03-28 10:39:06 +01:00
Yorick van Pelt
ada2af4f88
nix_api_expr: add nix_gc_now()
2024-03-28 10:39:06 +01:00
Yorick van Pelt
ded0ef6f6c
nix_api_expr: switch to refcounting
...
Remove GCRef, keep references in a map. Change to nix_gc_incref and
nix_gc_decref, where users will mostly use nix_gc_decref.
2024-03-28 10:39:05 +01:00
Yorick van Pelt
bebee700ea
nix_api_external: own return strings on the nix side
...
Change from nix_returned_string that passes ownership, into a
nix_string_return parameter that can be set using nix_set_string_return.
2024-03-28 10:39:05 +01:00
Yorick van Pelt
022b918db1
nix_api_expr: remove bindingsbuilder refcounting
2024-03-28 10:39:05 +01:00
Yorick van Pelt
aa85f7d917
nix_api_expr: merge nix_parse_expr and nix_expr_eval, remove Expr
2024-03-28 10:39:05 +01:00
Yorick van Pelt
1777e4a5bb
nix_api_store: add userdata param to nix_store_build
2024-03-28 10:39:05 +01:00
Yorick van Pelt
1e583c4ebd
nix_api_value: nix_{get,set}_double -> nix_{get,set}_float
2024-03-28 10:39:05 +01:00
Yorick van Pelt
efcddcdd2f
nix_api_external: fix missing void* self param
2024-03-28 10:39:05 +01:00
Yorick van Pelt
c3b5b8eb62
nix_api_expr, store: fix minor documentation issues
2024-03-28 10:39:05 +01:00
Yorick van Pelt
4a4936136b
nix_api_value: fix documentation for get_attr_byname
2024-03-28 10:39:04 +01:00
Puck Meerburg
748b322ddd
nix_api_value: fix primop arity
2024-03-28 10:39:04 +01:00
Yorick van Pelt
e76652a5d3
libexpr: add C bindings
2024-03-28 10:39:04 +01:00
Yorick van Pelt
1d41600498
libstore: add C bindings
2024-03-28 10:39:04 +01:00
Yorick van Pelt
4702317506
libutil: add C bindings
2024-03-28 10:39:04 +01:00
Yang, Bo
c39afb28db
Clarify stringLength is counting bytes
2024-03-27 16:46:50 -07:00
Eelco Dolstra
c0dd111af1
Fix flake evaluation in chroot stores
...
This is a temporary fix until we can pass `SourcePath`s rather than
`StorePath`s to `call-flake.nix`.
Fixes #10331 .
2024-03-27 20:49:56 +01:00
John Ericson
77205b2042
Allow for ergnomically putting Unix-only files in subdirs by creating INLCUDE_$(pkg)
vars
...
Separate platform-specific files will allow avoiding a lot of CPP.
2024-03-27 12:01:59 -04:00
annalee
7205a6bbc9
enable persistent WAL mode for sqlite db
...
allow processes without write access to the directory containing the db
to read the db when all connections are closed. Without this setting and
with WAL enabled and no open db connections unprivileged processes will
fail to open the db due the WAL files not existing and not able to
create them. When the WAL files are persistent unprivileged processeses
can read the db when there are no open connections.
Additionally, journal_size_limit is set to 2^40, which results in the
WAL files being truncated to 0 on exit, as well as limiting the WAL
files to 2^40 bytes following a checkpoint.
https://www.sqlite.org/c3ref/c_fcntl_begin_atomic_write.html#sqlitefcntlpersistwal
https://www.sqlite.org/pragma.html#pragma_journal_size_limit
ed517a7082/src/wal.c (L2518)
Fixes https://github.com/NixOS/nix/issues/10300
2024-03-27 15:36:09 +00:00
Robert Hensing
d4fa0a84a5
refact: TraceKind -> TracePrint
...
Co-authored-by: Rebecca Turner <rbt@sent.as>
2024-03-27 16:32:49 +01:00
Robert Hensing
bed541b04e
error.cc: Make printTrace static
2024-03-27 16:28:04 +01:00
Robert Hensing
981c309057
Remove trace item: while calling the 'addErrorContext' builtin
2024-03-27 16:28:04 +01:00
Robert Hensing
bebacc475c
Always print addErrorContext traces
2024-03-27 16:28:04 +01:00
Cyclic4179
a2c3333b97
fix #10336
2024-03-27 07:47:36 +01:00
Théophane Hufschmitt
6c10cc0eda
Merge pull request #10312 from hercules-ci/add-build-dir
...
Add build-dir setting
2024-03-26 13:51:50 +01:00
Théophane Hufschmitt
0bf01917ef
Merge pull request #10325 from K900/ooformatting
...
build-remote: fix format string shenanigans
2024-03-26 11:45:32 +01:00
Théophane Hufschmitt
1394d4e9c5
Merge pull request #10306 from hercules-ci/baseNameOf
...
Test and document `builtins.baseNameOf`, improve internal `baseNameOf()`
2024-03-26 09:59:27 +01:00
K900
2d4edb945b
build-remote: fix format string shenanigans
...
HintFmt(string) invokes the HintFmt("%s", literal) constructor,
which is not what we want here. Add a constructor with a proper name
and call that.
Next step: rename all the other ones to HintFmt::literal(string).
Fixes https://github.com/NixOS/nix/issues/10238
2024-03-26 11:01:03 +03:00
Robert Hensing
8b16cced18
Add build-dir setting
2024-03-25 19:48:59 +01:00
Robert Hensing
b1fe388d33
Remove uncalled for message
2024-03-25 19:48:57 +01:00
Eelco Dolstra
c82623a6cc
Remove value clearing since it no longer has an effect
2024-03-25 19:21:25 +01:00
Eelco Dolstra
8c0590fa32
Never update values after setting the type
...
Thunks are now overwritten by a helper function
`Value::finishValue(newType, payload)` (where `payload` is the
original anonymous union inside `Value`). This helps to ensure we
never update a value elsewhere, since that would be incompatible with
parallel evaluation (i.e. after a value has transitioned from being a
thunk to being a non-thunk, it should be immutable).
There were two places where this happened: `Value::mkString()` and
`ExprAttrs::eval()`.
This PR also adds a bunch of accessor functions for value contents,
like `Value::integer()` to access the integer field in the union.
2024-03-25 19:21:25 +01:00
Eelco Dolstra
6d90287f5a
Merge pull request #10303 from hercules-ci/fix-empty-TMPDIR
...
fix: Treat empty TMPDIR as unset
2024-03-25 12:49:10 +01:00
Robert Hensing
9884018dfa
baseNameOf(): Remove all trailing slashes
2024-03-24 01:38:22 +01:00
Robert Hensing
754a15e2db
builtins.baseNameOf: Fork
2024-03-24 01:37:58 +01:00
Robert Hensing
175afc7106
Test and document builtins.baseNameOf
2024-03-24 01:26:17 +01:00
Robert Hensing
3b7f2bf997
git/dumpTree: Assert name not empty before back()
2024-03-24 00:58:08 +01:00
Robert Hensing
850c9a6caf
HttpBinaryCacheStore: Remove *all* trailing slashes
2024-03-24 00:52:14 +01:00
Robert Hensing
dd26f41379
local-derivation-goal.cc: Remove *all* trailing slashes
2024-03-24 00:52:14 +01:00
Robert Hensing
fd31945742
local-derivation-goal.cc: Reuse defaultTempDir()
2024-03-24 00:45:15 +01:00
Robert Hensing
b9e7f5aa2d
fix: Treat empty XDG_RUNTIME_DIR as unset
...
See preceding commit. Not observed in the wild, but is sensible
and consistent with TMPDIR behavior.
2024-03-24 00:42:31 +01:00
Robert Hensing
c3fb2aa1f9
fix: Treat empty TMPDIR as unset
...
Fixes an instance of
nix: src/libutil/util.cc:139: nix::Path nix::canonPath(PathView, bool): Assertion `path != ""' failed.
... which I've been getting in one of my shells for some reason.
I have yet to find out why TMPDIR was empty, but it's no reason for
Nix to break.
2024-03-24 00:42:31 +01:00
detroyejr
717391731c
flakes: remove experimental repl-flake
2024-03-22 19:30:03 -04:00
Eelco Dolstra
bfd36402ac
EvalCache: Fix missing format string argument
...
Fixes
terminate called after throwing an instance of 'boost::wrapexcept<boost::io::too_few_args>'
what(): boost::too_few_args: format-string referred to more arguments than were passed
Aborted (core dumped)
for type errors in AttrCursor.
2024-03-22 18:11:24 +01:00
Robert Hensing
a223280664
Merge pull request #10286 from hercules-ci/various
...
Allocate a bit less
2024-03-22 11:19:58 +01:00
Théophane Hufschmitt
f666eda94d
Merge pull request #10274 from tweag/warn-on-untrusted-setting
...
Daemon: warn when an untrusted user cannot override a setting
2024-03-21 16:40:24 +01:00
Théophane Hufschmitt
039b3fbdfe
Merge pull request #10271 from jonringer/document-flake-multiple-outputs
...
Document how to build many outputs of a flake package
2024-03-21 15:58:32 +01:00
Robert Hensing
1fcdd1640e
functionArgs: Allocate bools only once
2024-03-20 23:25:28 +01:00
Robert Hensing
8c6e0df45f
value.hh: Fix warning about {struct/class} Value
2024-03-20 23:25:28 +01:00
Robert Hensing
a865049c4f
tryEval: Allocate true and false once
2024-03-20 23:25:28 +01:00
Robert Hensing
d71e74838a
readDir: Allocate type strings only once
2024-03-20 23:25:28 +01:00
Jonathan Ringer
4c8a33ce46
Update src/nix/build.md
...
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2024-03-20 14:42:44 -07:00
Robert Hensing
7d2ead50e5
Merge pull request #10083 from lf-/jade/refactor-repl-input
...
refactor: move the repl input code to its own file
2024-03-20 22:37:40 +01:00
Robert Hensing
d16d7f5f31
Merge pull request #10251 from edolstra/list-builder
...
Add a ListBuilder helper for constructing list values
2024-03-20 22:30:38 +01:00
Robert Hensing
d4b0b7f152
createBaseEnv: Use state.vNull
2024-03-20 21:34:23 +01:00
Robert Hensing
0b08dd45b0
prim_match: Use state.vNull
2024-03-20 21:28:38 +01:00
Félix Baylac-Jacqué
40a7929c8e
Daemon: warn when an untrusted user cannot override a setting
...
In a daemon-based Nix setup, some options cannot be overridden by a
client unless the client's user is considered trusted.
Currently, if an untrusted user tries to override one of those
options, we are silently ignoring it.
This can be pretty confusing in certain situations.
e.g. a user thinks he disabled the sandbox when in reality he did not.
We are now sending a warning message letting know the user some options
have been ignored.
Related to #1761 .
This is a cherry-pick of 9e0f5f803f
.
The above commit has been reverted by
a59e77d9e5
to prevent spamming warnings
with experimental features, but these are now totally ignored on the
daemon side, so there's no reason for the revert any more.
2024-03-20 17:55:35 +01:00
Théophane Hufschmitt
346f92aa4c
Merge pull request #10241 from bouk/resolve-ref-packed-refs
...
git fetcher: use resolveRef for getting revision of reference
2024-03-20 17:37:15 +01:00
Jonathan Ringer
a5262fb880
Document how to build many outputs of a flake package
2024-03-19 17:37:04 -07:00
John Ericson
18945e3f44
Merge branch 'master' into overlayfs-store
2024-03-18 16:43:33 -04:00
John Ericson
cd35e00103
Adding missing tracking URL for local overlay store
...
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2024-03-18 16:41:16 -04:00
lelgenio
ad217ddbbc
Document builtins.storePath being disabled by pure-eval
2024-03-18 16:23:17 -03:00
Yueh-Shun Li
d2b512959c
builtins.addDrvOutputDependencies: fix commentary
2024-03-18 02:38:31 +08:00
Yueh-Shun Li
39b0b8452f
doc: builtins.addDrvOutputDependencies: fix link target
2024-03-17 06:13:14 +08:00
Eelco Dolstra
3e6730ee62
Mark Value pointers in Value::elems as const
...
This catches modification of finalized values (e.g. in prim_sort).
2024-03-15 18:26:37 +01:00
Eelco Dolstra
fecff520d7
Add a ListBuilder helper for constructing list values
...
Previously, `state.mkList()` would set the type of the value to tList
and allocate the list vector, but it would not initialize the values
in the list. This has two problems:
* If an exception occurs, the list is left in an undefined state.
* More importantly, for multithreaded evaluation, if a value
transitions from thunk to non-thunk, it should be final (i.e. other
threads should be able to access the value safely).
To address this, there now is a `ListBuilder` class (analogous to
`BindingsBuilder`) to build the list vector prior to the call to
`Value::mkList()`. Typical usage:
auto list = state.buildList(size);
for (auto & v : list)
v = ... set value ...;
vRes.mkList(list);
2024-03-15 18:26:37 +01:00
Dimitar Nestorov
a50295425e
docs: update registry examples
...
When you run `nix flake info` you get a deprecated message
2024-03-14 16:15:52 +02:00
Bouke van der Bijl
60c2d15f5a
git fetcher: use resolveRef for getting revision of reference
...
* Add regression test
* Fix 'no repo' test so it doesn't succeed if the data is still in cache
* Use git_revparse_single inside git-utils instead of reimplementing the same logic.
2024-03-14 14:04:51 +01:00
Emanuel Czirai
e5840d5760
typo consant->constant in context.cc
2024-03-13 20:35:24 +01:00
Jade Lovelace
ea31b8a117
refactor: repl prompts are now the job of the interacter
2024-03-12 18:25:35 -07:00
Jade Lovelace
70a6ce139b
refactor: move readline stuff into its own file
...
This is in direct preparation for an automation mode of nix repl.
2024-03-12 18:25:35 -07:00
Jade Lovelace
76aced6915
finally.hh: delete copy constructor which is a bad idea
2024-03-12 18:25:35 -07:00
Eelco Dolstra
bff5c94184
Merge pull request #10205 from 9999years/final-matchers
...
Make `Matcher` subclasses `final`
2024-03-12 07:23:15 +01:00
Eelco Dolstra
18b89ca58c
Merge pull request #10227 from tmplt/doc/nix-copy
...
nix-copy: document --all --from local binary cache example
2024-03-12 07:22:28 +01:00
Théophane Hufschmitt
18b2ef8b20
Merge pull request #10209 from 9999years/rethrow-for-top-level-errors-in-repl
...
Print top-level errors normally in `nix repl`
2024-03-11 21:11:28 +01:00
Viktor Sonesten
db36c9ca90
nix-copy: document --all --from local binary cache example
2024-03-11 19:17:45 +01:00
tomberek
25bf671015
Merge pull request #10200 from 9999years/fix-nix-eval-for-derivations
...
Fix `nix eval nixpkgs#bash` segfault
2024-03-11 13:56:49 -04:00
Robert Hensing
3539172fd2
Merge pull request #10208 from 9999years/print-strings-directly
...
`:print` strings directly in `nix repl`
2024-03-11 10:02:09 +01:00
Rebecca Turner
db9bab2708
Matcher
: Add virtual destructor
2024-03-10 12:56:07 -07:00
Eelco Dolstra
841fd78baa
GitArchiveInputScheme: Support the narHash attribute
...
This is required to produce a locked flakeref.
2024-03-10 14:08:55 +01:00
Rebecca Turner
d13c63afa2
Print top-level errors normally in nix repl
...
Previously, errors while printing values in `nix repl` would be printed
in `«error: ...»` brackets rather than displayed normally:
```
nix-repl> legacyPackages.aarch64-darwin.pythonPackages.APScheduler
«error: Package ‘python-2.7.18.7’ in /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:335 is marked as insecure, refusing to evaluate.»
```
Now, errors will be displayed normally if they're emitted at the
top-level of an expression:
```
nix-repl> legacyPackages.aarch64-darwin.pythonPackages.APScheduler
error:
… in the condition of the assert statement
at /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/lib/customisation.nix:268:17:
267| in commonAttrs // {
268| drvPath = assert condition; drv.drvPath;
| ^
269| outPath = assert condition; drv.outPath;
… in the left operand of the OR (||) operator
at /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/passthrufun.nix:28:45:
27| if lib.isDerivation value then
28| lib.extendDerivation (valid value || throw "${name} should use `buildPythonPackage` or `toPythonModule` if it is to be part of the Python packages set.") {} value
| ^
29| else
(stack trace truncated; use '--show-trace' to show the full trace)
error: Package ‘python-2.7.18.7’ in /nix/store/6s0m1qc31zw3l3kq0q4wd5cp3lqpkq0q-source/pkgs/development/interpreters/python/cpython/2.7/default.nix:335 is marked as insecure, refusing to evaluate.
```
Errors emitted in nested structures (like e.g. when printing `nixpkgs`)
will still be printed in brackets.
2024-03-09 18:28:04 -08:00
Rebecca Turner
d859d6c434
:print
strings directly in nix repl
...
Strings are now printed directly when evaluated by `:print`, rather than
escaped. This makes it easier to debug multi-line strings or strings
containing quotes, like the results of `builtins.readFile`,
`lib.toShellArg`, and so on.
```
nix-repl> "cuppy\ndog\ncity"
"cuppy\ndog\ncity"
nix-repl> :p "cuppy\ndog\ncity"
cuppy
dog
city
```
2024-03-09 18:13:08 -08:00
Rebecca Turner
70e93c1e2b
Make Matcher
subclasses final
...
Fixes this very long warning, which I'll only include the first line of:
/nix/store/8wrjhrycpshhc3b41xmjwvgqr2m3yajq-libcxx-16.0.6-dev/include/c++/v1/__memory/construct_at.h:66:5: warning: destructor called on non-final 'RegexMatcher' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
__loc->~_Tp();
2024-03-09 17:07:52 -08:00