aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2023-06-26Merge pull request #8576 from obsidiansystems/findPath-cleanupEelco Dolstra
Use a struct not `std::pair` for `SearchPathElem`
2023-06-24Merge pull request #5385 from Enzime/add/dirty-revThéophane Hufschmitt
Add `dirtyRev` and `dirtyShortRev` to `fetchGit`
2023-06-24Add `dirtyRev` and `dirtyShortRev` to `fetchGit`Michael Hoang
Fixes #4682
2023-06-23Use a struct not `std::pair` for `SearchPathElem`John Ericson
I got very confused trying to keep all the `first` and `second` straight reading the code, *especially* as there is also another `(boolean, string)` pair type also being used. Named fields is much better. There are other cleanups that we can do (for example, the existing TODO), but we can do them later. Doing them now would just make this harder to review.
2023-06-23Merge pull request #8519 from fricklerhandwerk/reword-trusted-usersRobert Hensing
reword documentation on trusted users and substituters
2023-06-23Merge pull request #8574 from inclyc/nixd/remove-unused-tokenEelco Dolstra
libexpr: remove unused token `ATTRPATH` in token declaration
2023-06-23libexpr: remove unused token `ATTRPATH` in token declarationYingchi Long
2023-06-22Better document build failure exit codesJohn Ericson
- Improved API docs from comment - Exit codes are for `nix-build`, not just `nix-store --release` - Make note in tests so the magic numbers are not surprising Picking up where #8387 left off.
2023-06-22libexpr: extend `Value::print` to allow limited depthYingchi Long
2023-06-22libexpr: add tests for `nix::Value::print`Yingchi Long
2023-06-21Merge pull request #8374 from obsidiansystems/improve-path-settingJohn Ericson
Split `OptionalPathSetting` from `PathSetting`
2023-06-20be more serious about security risks with trusted usersValentin Gagarin
2023-06-20Merge pull request #8552 from edolstra/fix-eagainEelco Dolstra
GC server: Clear O_NONBLOCK on the right file descriptor
2023-06-20Support opening local store with database on read-only filesystem (#8356)Ben Radford
Previously it was not possible to open a local store when its database is on a read-only filesystem. Obviously a store on a read-only filesystem cannot be modified, but it would still be useful to be able to query it. This change adds a new read-only setting to LocalStore. When set to true, Nix will skip operations that fail when the database is on a read-only filesystem (acquiring big-lock, schema migration, etc), and the store database will be opened in immutable mode. Co-authored-by: Ben Radford <benradf@users.noreply.github.com> Co-authored-by: cidkidnix <cidkidnix@protonmail.com> Co-authored-by: Dylan Green <67574902+cidkidnix@users.noreply.github.com> Co-authored-by: John Ericson <git@JohnEricson.me> Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-06-20GC server: Clear O_NONBLOCK on the right file descriptorEelco Dolstra
The bug fix in 6d30f9e6fea7d451033653f8f167aef58f7f5347 erroneously cleared O_NONBLOCK on the server rather than client FD (leaving both in an incorrect state). Fixes #8551.
2023-06-19Remove unused `#include` from `local-derivation-goal.cc`John Ericson
These were never needed for this file, and date back to before this was split from `derivation-goal.cc`.
2023-06-19Create `worker_proto::{Read,Write}Conn`John Ericson
Pass this around instead of `Source &` and `Sink &` directly. This will give us something to put the protocol version on once the time comes. To do this ergonomically, we need to expose `RemoteStore::Connection`, so do that too. Give it some more API docs while we are at it.
2023-06-19Likewise namespace and `enum struct`-ify `ServeCommand`John Ericson
The motivation is exactly the same as for the last commit. In addition, this anticipates us formally defining separate serialisers for the serve protocol.
2023-06-19Put worker protocol items inside a `WorkerProto` structJohn Ericson
See API docs on that struct for why. The pasing as as template argument doesn't yet happen in that commit, but will instead happen in later commit. Also make `WorkerOp` (now `Op`) and enum struct. This led us to catch that two operations were not handled! Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-06-19Split out worker protocol template definitions from declarationsJohn Ericson
This is generally a fine practice: Putting implementations in headers makes them harder to read and slows compilation. Unfortunately it is necessary for templates, but we can ameliorate that by putting them in a separate header. Only files which need to instantiate those templates will need to include the header with the implementation; the rest can just include the declaration. This is now documenting in the contributing guide. Also, it just happens that these polymorphic serializers are the protocol agnostic ones. (Worker and serve protocol have the same logic for these container types.) This means by doing this general template cleanup, we are also getting a head start on better indicating which code is protocol-specific and which code is shared between protocols.
2023-06-19Merge pull request #8483 from edolstra/save-rootEelco Dolstra
restoreMountNamespace(): Restore the original root directory
2023-06-19Merge pull request #8524 from amjoseph-nixpkgs/pr/doc/linkify-allowed-urisEelco Dolstra
src/libexpr/eval.hh: add link for allowed-uris option
2023-06-19Clean up a few things related to profiles (#8526)John Ericson
- Greatly expand API docs - Clean up code in misc ways - Instead of a complicated single loop on generations, do different operations in successive subsequent steps. - Avoid `ref` in one place where `&` is fine - Just return path instead of mutating an argument in `makeName` Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-06-18src/libexpr/eval.hh: add link for allowed-uris optionAdam Joseph
This commit adds a link to the documentation for `--option allowed-uris` where that option is mentioned while describing `restrict-eval`.
2023-06-18Split `OptionalPathSetting` from `PathSetting`John Ericson
Rather than doing `allowEmpty` as boolean, have separate types and use `std::optional`. This makes it harder to forget the possibility of an empty path. The `build-hook` setting was categorized as a `PathSetting`, but actually it was split into arguments. No good! Now, it is `Setting<Strings>` which actually reflects what it means and how it is used. Because of the subtyping, we now also have support for `Setting<std::optional<String>>` in general. I imagine this can be used to clean up many more settings also.
2023-06-18Create nlohmann serializers for `std::optional` and useJohn Ericson
This is somewhat tricky.
2023-06-16Merge pull request #8477 from edolstra/tarball-flake-redirectsEelco Dolstra
Tarball flake improvements
2023-06-16Update src/libstore/globals.hhValentin Gagarin
2023-06-16fix typoValentin Gagarin
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-06-16do not refer to `trusted-users` another timeValentin Gagarin
2023-06-16use "store URLs" consistentlyValentin Gagarin
2023-06-16fix link textValentin Gagarin
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-06-16Merge pull request #8517 from hercules-ci/fix-build-hook-error-for-lib-usersEelco Dolstra
Fix build hook error for libstore library users
2023-06-15Don't assume the type of string::size_typeThéophane Hufschmitt
The code accidentally conflated `std::string::size_type` and `long unsigned int`. This was fine on 64bits machines where they are apparently the same in practice, but not on 32bits. Fix that by using `std::string::size_type` everywhere.
2023-06-15Update src/libstore/globals.hhValentin Gagarin
2023-06-15Fix build hook error for libstore library usersRobert Hensing
A library shouldn't require changes to the caller's argument handling, especially if it doesn't have to, and indeed we don't have to. This changes the lookup order to prioritize the hardcoded path to nix if it exists. The static executable still finds itself through /proc and the like.
2023-06-15Update src/nix/daemon.ccJohn Ericson
Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-06-14src/libexpr/eval.hh: fix typoAdam Joseph
The option name is `allowed-uris`, not `allowed-uri`.
2023-06-15fix wordingValentin Gagarin
2023-06-15reword documentation on trusted users and substitutersValentin Gagarin
this is to make it slightly easier to scan over
2023-06-15Merge pull request #8516 from wentasah/remove-registerprimopJohn Ericson
Remove RegisterPrimOp constructor without support for documentation
2023-06-14Fixup description of substituters (#8291)Valentin Gagarin
Introduce what substituters "are" in the configuration option entry. Remove arbitrary line breaks for easier editing in the future. Link glossary some more. Co-authored-by: Robert Hensing <roberth@users.noreply.github.com> Co-authored-by: John Ericson <git@JohnEricson.me>
2023-06-14Remove RegisterPrimOp constructor without support for documentationMichal Sojka
The remaining constructor RegisterPrimOp::RegisterPrimOp(Info && info) allows specifying the documentation in .args and .doc members of the Info structure. Commit 8ec1ba02109e removed all uses of the removed constructor in the nix binary. Here, we remove the constructor completely as well as its use in a plugin test. According to #8515, we didn't promis to maintain compatibility with external plugins. Fixes #8515
2023-06-14Merge pull request #8490 from flox/stdin_handlingJohn Ericson
fix: Do not apply default installables when using --stdin
2023-06-14Merge pull request #8491 from wentasah/builtins-docJohn Ericson
Document several undocumented builtin functions
2023-06-14Remove dead code (#8504)Daniel Asaturov
`filesystem.cc` is the only place where `createSymlink()` is used with three arguments: in the definition of `replaceSymlink()` with three parameters that _is not used at all_. Closes #8495
2023-06-14Merge pull request #4803 from ShamrockLee/nix-channel-list-generationsJohn Ericson
Add `nix-channel --list-generations`
2023-06-14Merge pull request #4282 from tweag/fix-ca-hash-rewritingJohn Ericson
fix the hash rewriting for ca-derivations
2023-06-13Document fromTOML, hasContext and getContext builtinsMichal Sojka
Until now, these functions were completely missing in the Nix manual. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-06-13Allow tarball URLs to redirect to a lockable immutable URLEelco Dolstra
Previously, for tarball flakes, we recorded the original URL of the tarball flake, rather than the URL to which it ultimately redirects. Thus, a flake URL like http://example.org/patchelf-latest.tar that redirects to http://example.org/patchelf-<revision>.tar was not really usable. We couldn't record the redirected URL, because sites like GitHub redirect to CDN URLs that we can't rely on to be stable. So now we use the redirected URL only if the server returns the `x-nix-is-immutable` or `x-amz-meta-nix-is-immutable` headers in its response.