Maximilian Bosch
c80cd6bb06
path-info: print correct path when using nix path-info --store file://... --all --json
...
When querying all paths in a binary cache store, the path's representation
is `<hash>-x` (where `x` is the value of `MissingName`) because the .narinfo
filenames only contain the hash.
Before cc46ea1630
this worked correctly,
because the entire path info was read and the path from this
representation was printed, i.e. in the form `<hash>-<name>`. Since then
however, the direct result from `queryAllValidPaths()` was used as `path`.
Added a regression test to make sure the behavior remains correct.
2024-04-05 21:29:55 +02:00
John Ericson
5a365b0c89
Delete dead openFile
in binary-cache-store.cc
( #10418 )
...
d64cb33e90
/ #5111 previously deleted the dead code where this was used, but missed this.
2024-04-05 18:31:43 +00:00
John Ericson
a3d5a71c5f
Slight cleanup of builtins.derivation
outputHashAlgo
logic ( #10417 )
...
This was part of approved PR #10021 . Unfortunately that one is stalled
on a peculiar Linux test timeout, so trying to get bits of it merged
first to bisect failure.
2024-04-05 18:10:28 +00:00
John Ericson
513634ab5b
Make cgroup.{cc,hh}
linux-only files
...
Forcing a conditional include, vs making the headers content
conditional, I think is more maintainable.
It is also how the other platform-specific headers (like
`namespaces.hh`) have been adapted.
2024-04-05 12:29:14 -04:00
Robert Hensing
c145ce0e1a
realiseContext: Remove no-op replacements
...
A possible use of them might have been to figure out the paths
(which can now be retrieved with maybePathsOut), but I have
not found evidence that it was used this way, and it would have
been broken, because non-CA outputs weren't recorded in the map.
2024-04-05 16:15:43 +02:00
Robert Hensing
02c41aba5b
libexpr-c: Add nix_string_realise
2024-04-05 16:08:18 +02:00
Eelco Dolstra
75be3f23c6
setInterruptCheck(): Remove declared but undefined function
2024-04-05 16:03:25 +02:00
John Ericson
50f621b241
Better signals interface
...
This avoids some CPP and accidentally using Unix stuff in client code.
2024-04-05 01:38:28 -04:00
John Ericson
c1e0769355
Fix some portability issues with the new C bindings
...
Build without GC is unbroken
Fix #10403
Also building tests with Windows (assuming rest of Windows fixes) is
unbroken.
2024-04-05 00:54:47 -04:00
John Ericson
ef2d10f7e7
Clean up env var logic in preparation for Windows
...
It's a little weird we don't check the return status for these, but
changing that would introduce risk so I did not.
Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
2024-04-04 18:17:12 -04:00
John Ericson
1577b5fa67
Make SQLite busy back-off logic portable
...
Use C++ standard library not Unix functions for sleeping and randomness.
Suggested by @edolstra in https://github.com/NixOS/nix/pull/8901#discussion_r1550416615
2024-04-04 12:43:33 -04:00
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