aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.cc
AgeCommit message (Collapse)Author
2023-03-02Remove FormatOrString and remaining uses of format()Eelco Dolstra
2023-02-28Always set valid in path-info --json outputMatthew Kenigsberg
Currently the valid key is only present when the path is invalid, which makes checking path validity more complex than it should be. With this change, the valid key can always be used to check if a path is valid
2023-02-28No inheritance for `TextInfo` and `FixedOutputInfo`John Ericson
2023-02-28Revert "Remove some designated initializers"John Ericson
This reverts commit ee9eb83a842eb97d0180fd9d349d30ff27fdb485.
2023-02-28Clarify store path grammar and improve comment on `makeType`John Ericson
2023-02-28Fix typo in the method nameJohn Ericson
2023-02-02Merge branch 'master' into path-infoJohn Ericson
2023-02-01Remove an unused captureEelco Dolstra
2023-02-01Remove some designated initializersJohn Ericson
With the switch to C++20, the rules became more strict, and we can no longer initialize base classes. Make them comments instead. (BTW https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p2287r1.html this offers some new syntax for this use-case. Hopefully this will be adopted and we can eventually use it.)
2023-01-30Avoid some `StorePath` <-> `Path` round tripsJohn Ericson
Avoid needless work and throwing away invariants. These conversions date back to when `StorePath` was in Rust and there were issues with it missing utility methods.
2023-01-23Don't add `StorePathDescriptor` for nowJohn Ericson
We don't need it yet, we can add it back later.
2023-01-14Make `ValidPathInfo` have plain `StorePathSet` references like beforeJohn Ericson
This change can wait for another PR.
2023-01-14Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
2023-01-13Move `ValidPathInfo` defintions to `path-info.cc`John Ericson
Originally there was no `path-info.*`, then there was `path-info.hh`, then there was `path-info.cc`, but only for new things. Moving this stuff over makes everything consistent.
2023-01-13Move new `ValidPathInfo` methods to path-info.ccJohn Ericson
We'll move the old ones separately, so as not to clutter the diff.
2023-01-13Merge pull request #7430 from tweag/ca/fix-nix-logThéophane Hufschmitt
Ca/fix nix log
2023-01-06Do big rename to clean up codeJohn Ericson
- `PathReferences` -> `References` - `PathReferences<StorePath>` -> `StoreReference` - `references` -> `others` - `hasSelfReference` -> `self` And get rid of silly subclassing
2023-01-06Optimize `ValidPathInfo` construction a bit betterJohn Ericson
2023-01-06Use named field initialization for referencesJohn Ericson
2023-01-06Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
2022-12-24libstore: Make sure that initNix has been calledRobert Hensing
Prevent bugs like https://github.com/cachix/cachix/pull/477
2022-12-08fix missing function after rebaseTaeer Bar-Yam
2022-12-08Fix `nix log` with CA derivationsregnat
Fix #6209 When trying to run `nix log <installable>`, try first to resolve the derivation pointed to by `<installable>` as it is the resolved one that holds the build log. This has a couple of shortcomings: 1. It’s expensive as it requires re-reading the derivation 2. It’s brittle because if the derivation doesn’t exist anymore or can’t be resolved (which is the case if any one of its build inputs is missing), then we can’t access the log anymore However, I don’t think we can do better (at least not right now). The alternatives I see are: 1. Copy the build log for the un-resolved derivation. But that means a lot of duplication 2. Store the results of the resolving in the db. Which might be the best long-term solution, but leads to a whole new class of potential issues.
2022-12-07Trivial changes from the lazy-trees branchEelco Dolstra
2022-11-16Replace src/libutil/json.cc with nlohmann json generationYorick van Pelt
2022-10-12Make warning about chroot store location more accurateSteam Deck User
While trying to use an alternate directory for my Nix installation, I noticed that nix's output didn't reflect the updated state directory. This patch corrects that and now prints the warning before attempting to create the directory (if the directory creation fails, it wouldn't have been obvious why nix was attempting to create the directory in the first place). With this patch, I now get the following warning: warning: '/home/deck/.var/app/org.nixos.nix/var/nix' does not exist, so Nix will use '/home/deck/.local/share/nix/root' as a chroot store
2022-08-24Remove redundant FinallyEelco Dolstra
2022-08-24Fix macOS buildEelco Dolstra
2022-08-23Fix a hang in nix-copy-ssh.shEelco Dolstra
This hang for some reason didn't trigger in the Nix build, but did running 'make installcheck' interactively. What happened: * Store::addMultipleToStore() calls a SinkToSource object to copy a path, which in turn calls LegacySSHStore::narFromPath(), which acquires a connection. * The SinkToSource object is not destroyed after the last bytes has been read, so the coroutine's stack is still alive and its destructors are not run. So the connection is not released. * Then when the next path is copied, because max-connections = 1, LegacySSHStore::narFromPath() hangs forever waiting for a connection to be released. The fix is to make sure that the source object is destroyed when we're done with it.
2022-07-20Merge branch 'master' into parallel-nix-copyThéophane Hufschmitt
2022-07-19Don't ultimately trust the signed pathsThéophane Hufschmitt
Like the old implem did (and like you'd want it to be anyways)
2022-07-15Disable auto-chroot if $NIX_STATE_DIR is setEelco Dolstra
Issue #6732.
2022-07-14Disable auto-chroot if $NIX_STORE_DIR is setEelco Dolstra
Fixes #6732.
2022-06-29Don't fail if we can't create ~/.local/share/nix/rootEelco Dolstra
https://hydra.nixos.org/build/182135943
2022-06-24Only do the auto chroot store on LinuxEelco Dolstra
2022-06-23Fix typoEelco Dolstra
Co-authored-by: Cole Helbling <cole.e.helbling@outlook.com>
2022-06-23Automatically use a chroot store if /nix doesn't existEelco Dolstra
Specifically, if we're not root and the daemon socket does not exist, then we use ~/.local/share/nix/root as a chroot store. This enables non-root users to download nix-static and have it work out of the box, e.g. ubuntu@ip-10-13-1-146:~$ ~/nix run nixpkgs#hello warning: '/nix' does not exists, so Nix will use '/home/ubuntu/.local/share/nix/root' as a chroot store Hello, world!
2022-06-08Rewrite the CA paths when moving them between storeThéophane Hufschmitt
Bring back the possibility to copy CA paths with no reference (like the outputs of FO derivations or stuff imported at eval time) between stores that have a different prefix.
2022-06-08Restore the "low-latency" ssh copyingThéophane Hufschmitt
2022-06-03Make nix copy parallel againThéophane Hufschmitt
FILLME
2022-05-04Get rid of most `.at` calls (#6393)Alain Zscheile
Use one of `get` or `getOr` instead which will either return a null-pointer (with a nicer error message) or a default value when the key is missing.
2022-03-25Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
2022-03-17Clean up `DerivationOutput`, and headersJohn Ericson
1. `DerivationOutput` now as the `std::variant` as a base class. And the variants are given hierarchical names under `DerivationOutput`. In 8e0d0689be797f9e42f9b43b06f50c1af7f20b4a @matthewbauer and I didn't know a better idiom, and so we made it a field. But this sort of "newtype" is anoying for literals downstream. Since then we leaned the base class, inherit the constructors trick, e.g. used in `DerivedPath`. Switching to use that makes this more ergonomic, and consistent. 2. `store-api.hh` and `derivations.hh` are now independent. In bcde5456cc3295061a0726881c3e441444dd6680 I swapped the dependency, but I now know it is better to just keep on using incomplete types as much as possible for faster compilation and good separation of concerns.
2022-03-10Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
2022-02-25Remove std::string alias (for real this time)Eelco Dolstra
Also use std::string_view in a few more places.
2022-02-19path-info: use full store paths when we have themLinus Heckemann
Fixes #5645
2022-01-21Merge pull request #5949 from obsidiansystems/old-copyClosureEelco Dolstra
Add back `copyClosure` for plain `StorePath`s
2022-01-20Add back `copyClosure` for plain `StorePath`sJohn Ericson
This was removed in 2e199673a523fa81de31ffdd2a25976ce0814631 when `copyPath` transitioned to use `RealisedPath`. But then in e9848beca704d27a13e28b4403251725bd485bb2 we added it back just for `realisedPath`. I think it is a good utility function --- one can easily imagine it becoming optimized in the future, and copying paths *violating* the closure is a very niche feature. So if we have `copyPaths` for both sorts of paths, I think we should have `copyClosure` for both sorts too.
2021-11-30Tidy up the loggingJohn Ericson
Use the macros more, so we properly skip work when the log level excludes. Also log the daemon operation number on the daemon side.
2021-11-23"recursive-nix" system feature only with experimental featureJohn Ericson