aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
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-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-16Merge pull request #8477 from edolstra/tarball-flake-redirectsEelco Dolstra
Tarball flake improvements
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-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-14src/libexpr/eval.hh: fix typoAdam Joseph
The option name is `allowed-uris`, not `allowed-uri`.
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.
2023-06-13Add a generic check for rev attribute mismatchesEelco Dolstra
2023-06-12test: add test for non-defaulting for stding installable inputTom Bereknyei
2023-06-12Don't include uds-remote-store.md from a header fileEelco Dolstra
Closes #8484.
2023-06-11Register all PrimOps via the Info structureMichal Sojka
This will allow documenting them (in later commits). Note that we keep the old constructor even if it is no longer used by Nix code, because it is used in tests/plugins/plugintest.cc, which suggests that it might be used by some external plugin.
2023-06-11fix: Do not apply default installables when using --stdinTom Bereknyei
2023-06-09restoreMountNamespace(): Restore the original root directoryEelco Dolstra
This is necessary when we're in a chroot environment, where the process root is not the same as the root of the mount namespace (e.g. in nixos-enter). Fixes #7602.
2023-06-09Merge branch 'master' into angerman/mac-fix-recursive-nixEelco Dolstra
2023-06-09Parse TOML timestamps (#8120)Andrea Bedini
Currently `fromTOML` throws an exception when encountering a timestamp since the Nix language lacks a way to represent them. This patch changes this beaviour and makes `fromTOML` parse timestamps as attrsets of the format { _type = "timestamp"; value = "1979-05-27T07:32:00Z"; } This is guarded by an experimental feature flag to leave room for iterating on the representation.
2023-06-06Merge pull request #8391 from ↵Eelco Dolstra
aneeshusa/remove-wrong-default-value-in-docs-for-hashed-mirrors Remove old default from docs for `hashed-mirrors`
2023-06-06Merge pull request #8438 from zhaofengli/armv5tel-linux32Eelco Dolstra
Also set the PER_LINUX32 personality flag on armv5tel-linux
2023-06-06Merge pull request #8456 from emilytrau/include-selectEelco Dolstra
Add missing <sys/select.h> include
2023-06-06Fix SourcePath::resolveSymlinks()Eelco Dolstra
This fixes handling of symlinks that start with '..', and symlink targets that contain symlinks themselves.
2023-06-05Add missing <sys/select.h> includeEmily Trau
`select()` may not be ambiently available for use on every platform
2023-06-04Fix code block formatting in man pagefigsoda
2023-06-02Document manual migration for use-xdg-base-directories (#8044)Alexander Bantyev
* Document manual migration for use-xdg-base-directories As there's currently no automatic migration for use-xdg-base-directories option, add instructions for manual migration to the option's description. Co-authored-by: Valentin Gagarin <valentin.gagarin@tweag.io>
2023-06-02Also set the PER_LINUX32 personality flag on armv5tel-linuxZhaofeng Li
2023-06-02Add nix-channel --list-generationsShamrock Lee
Add support to --list-generations as another way to say nix-env --profile /nix/var/nix/profiles/per-user/$USER/channels --list-generations the way we did for nix-channel --rollback [generation id]
2023-05-31Merge pull request #8421 from fricklerhandwerk/doc-replaceStringsEelco Dolstra
update documentation according to release notes
2023-05-31Merge pull request #8318 from fricklerhandwerk/doc-currentTimeValentin Gagarin
document `builtins.currentTime`
2023-05-30update documentation according to release notesValentin Gagarin
2023-05-30Merge pull request #8398 from ↵Robert Hensing
polykernel/perf/lazy-eval-replacements-replacestrings primops: lazy evaluation of replaceStrings replacements
2023-05-30Merge pull request #8406 from NixOS/fix-ca-attrs-falseEelco Dolstra
Restore Nix 2.3 behaviour for {__impure,__contentAddressed} = false
2023-05-27Merge pull request #8399 from tweag/fix-chrooted-stores-error-pathEelco Dolstra
Properly report build errors on chrooted stores
2023-05-27Restore Nix 2.3 behaviour for {__impure,__contentAddressed} = falseEelco Dolstra
Fixes #8405.
2023-05-26create pathAccessible, use it to infer default dirsYorick van Pelt