aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.hh
AgeCommit message (Collapse)Author
2021-04-05Use `BuildableReq` for `buildPaths` and `ensurePath`John Ericson
This avoids an ambiguity where the `StorePathWithOutputs { drvPath, {} }` could mean "build `brvPath`" or "substitute `drvPath`" depending on context. It also brings the internals closer in line to the new CLI, by generalizing the `Buildable` type is used there and makes that distinction already. In doing so, relegate `StorePathWithOutputs` to being a type just for backwards compatibility (CLI and RPC).
2021-04-05Move `StorePathWithOutput` utilities out of store classJohn Ericson
These are by no means part of the notion of a store, but rather are things that happen to use stores. (Or put another way, there's no way we'd make them virtual methods any time soon.) It's better to move them out of that too-big class then. Also, this helps us remove StorePathWithOutputs from the Store interface altogether next commit.
2021-04-05Move `StorePathWithOutputs` into its own header/fileJohn Ericson
In the following commits it will become less prevalent.
2021-03-15Check the signatures when copying store paths aroundregnat
Broken atm
2021-03-15pathInfoIsTrusted -> pathInfoIsUntrustedregnat
I guess the rationale behind the old name wath that `pathInfoIsTrusted(info)` returns `true` iff we would need to `blindly` trust the path (because it has no valid signature and `requireSigs` is set), but I find it to be a really confusing footgun because it's quite natural to give it the opposite meaning.
2021-03-15Add some logic for signing realisationsregnat
Not exposed anywhere, but built realisations are now signed (and this should be forwarded when copy-ing them around)
2021-02-27Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
2021-02-26Merge pull request #4477 from NixOS/ca/build-remoteEelco Dolstra
Build ca derivations remotely
2021-02-25Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
2021-02-25Apply @edolstra stylistic suggestionsThéophane Hufschmitt
Mostly removing useless comments and adding spaces before `&` Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2021-02-25Use `RealisedPath`s in `copyPaths`regnat
That way we can copy the realisations too (in addition to the store paths themselves)
2021-02-23Make the build-hook work with ca derivationsregnat
- Pass it the name of the outputs rather than their output paths (as these don't exist for ca derivations) - Get the built output paths from the remote builder - Register the new received realisations
2021-02-19Register the realisations for unresolved drvsregnat
Once a build is done, get back to the original derivation, and register all the newly built outputs for this derivation. This allows Nix to work properly with derivations that don't have all their build inputs available − thus allowing garbage collection and (once it's implemented) binary substitution
2021-01-22Improve documentation and test and requestedJohn Ericson
2021-01-15Make public keys and `requireSigs` local-store specific againJohn Ericson
Thanks @regnat and @edolstra for catching this and comming up with the solution. They way I had generalized those is wrong, because local settings for non-local stores is confusing default. And due to the nature of C++ inheritance, fixing the defaults is more annoying than it should be. Additionally, I thought we might just drop the check in the substitution logic since `Store::addToStore` is now streaming, but @regnat rightfully pointed out that as it downloads dependencies first, that would still be too late, and also waste effort on possibly unneeded/unwanted dependencies. The simple and correct thing to do is just make a store method for the boolean logic, keeping all the setting and key stuff the way it was before. That new method is both used by `LocalStore::addToStore` and the substitution goal check. Perhaps we might eventually make it fancier, e.g. sending the ValidPathInfo to remote stores for them to validate, but this is good enough for now.
2021-01-15Merge remote-tracking branch 'upstream/master' into non-local-store-buildJohn Ericson
2021-01-13Add 'nix store repair' commandEelco Dolstra
2020-12-23Expose schedule entrypoints to all storesJohn Ericson
Remote stores still override so the other end schedules.
2020-12-23Move some PKI stuff from LocalStore to StoreJohn Ericson
2020-12-20Overhaul store subclassingJohn Ericson
We embrace virtual the rest of the way, and get rid of the `assert(false)` 0-param constructors. We also list config base classes first, so the constructor order is always: 1. all the configs 2. all the stores Each in the same order
2020-12-17Fix the detection of already built drv outputsregnat
PRs #4370 and #4348 had a bad interaction in that the second broke the fist one in a not trivial way. The issue was that since #4348 the logic for detecting whether a derivation output is already built requires some logic that was specific to the `LocalStore`. It happens though that most of this logic could be upstreamed to any `Store`, which is what this commit does.
2020-12-11Store metadata about drv outputs realisationsregnat
For each known realisation, store: - its output - its output path This comes with a set of needed changes: - New `realisations` module declaring the types needed for describing these mappings - New `Store::registerDrvOutput` method registering all the needed informations about a derivation output (also replaces `LocalStore::linkDeriverToPath`) - new `Store::queryRealisation` method to retrieve the informations for a derivations This introcudes some redundancy on the remote-store side between `wopQueryDerivationOutputMap` and `wopQueryRealisation`. However we might need to keep both (regardless of backwards compat) because we sometimes need to get some infos for all the outputs of a derivation (where `wopQueryDerivationOutputMap` is handy), but all the stores can't implement it − because listing all the outputs of a derivation isn't really possible for binary caches where the server doesn't allow to list a directory.
2020-11-17Merge pull request #4180 from Ma27/ssh-ng-substituteEelco Dolstra
Allow substituting paths when building remotely using `ssh-ng://`
2020-11-17CleanupEelco Dolstra
2020-11-05Allow substituting paths when building remotely using `ssh-ng://`Maximilian Bosch
Until now, it was not possible to substitute missing paths from e.g. `https://cache.nixos.org` on a remote server when building on it using the new `ssh-ng` protocol. This is because every store implementation except legacy `ssh://` ignores the substitution flag passed to `Store::queryValidPaths` while the `legacy-ssh-store` substitutes the remote store using `cmdQueryValidPaths` when the remote store is opened with `nix-store --serve`. This patch slightly modifies the daemon protocol to allow passing an integer value suggesting whether to substitute missing paths during `wopQueryValidPaths`. To implement this on the daemon-side, the substitution logic from `nix-store --serve` has been moved into a protected method named `Store::substitutePaths` which gets currently called from `LocalStore::queryValidPaths` and `Store::queryValidPaths` if `maybeSubstitute` is `true`. Fixes #2770
2020-10-12Merge remote-tracking branch 'upstream/master' into path-infoJohn Ericson
2020-10-09Split out `local-fs-store.hh`John Ericson
This matches the already-existing `local-fs-store.cc`.
2020-10-07Use PathReferences more widelyJohn Ericson
2020-10-06Shut up some clang warningsEelco Dolstra
2020-10-05Fix s3:// storeEelco Dolstra
Fixes https://github.com/NixOS/nixos-org-configurations/issues/123.
2020-10-05Merge pull request #3935 from obsidiansystems/binary-cache-addToStoreFromDumpEelco Dolstra
Get rid of Hash::dummy from BinaryCacheStore
2020-09-23Get rid of Hash::dummy from BinaryCacheStoreJohn Ericson
2020-09-22Deduplicate basic derivation goals tooJohn Ericson
See comments for security concerns. Also optimize goal creation by not traversing map twice.
2020-09-21Document addCAToStore/addToStoreFromDump source drainageRobert Hensing
Also checked that all usages satisfy the requirement and removed dead code.
2020-09-16Merge remote-tracking branch 'upstream/master' into ↵John Ericson
remove-storetype-delegate-regStore
2020-09-16Fix build issues with gccregnat
2020-09-16Add a name to the storesregnat
So that it can be printed by `nix describe-stores`
2020-09-16Document the new store hierarchyregnat
2020-09-16fixup! Correctly call all the parent contructors of the storesregnat
2020-09-16Properly filter the stores according to their declared uriSchemesregnat
When opening a store, only try the stores whose `uriSchemes()` include the current one
2020-09-16Correctly call all the parent contructors of the storesregnat
Using virtual inheritance means that only the default constructors of the parent classes will be called, which isn't what we want
2020-09-16Separate store configs from the implemsregnat
Rework the `Store` hierarchy so that there's now one hierarchy for the store configs and one for the implementations (where each implementation extends the corresponding config). So a class hierarchy like ``` StoreConfig-------->Store | | v v SubStoreConfig----->SubStore | | v v SubSubStoreConfig-->SubSubStore ``` (with virtual inheritance to prevent DDD). The advantage of this architecture is that we can now introspect the configuration of a store without having to instantiate the store itself
2020-09-16Separate the instantiation and initialisation of the storesregnat
Add a new `init()` method to the `Store` class that is supposed to handle all the effectful initialisation needed to set-up the store. The constructor should remain side-effect free and just initialize the c++ data structure. The goal behind that is that we can create “dummy” instances of each store to query static properties about it (the parameters it accepts for example)
2020-09-16Fix the registration of storesregnat
2020-09-16Make the store plugins more introspectableregnat
Directly register the store classes rather than a function to build an instance of them. This gives the possibility to introspect static members of the class or choose different ways of instantiating them.
2020-09-15Merge remote-tracking branch 'upstream/master' into ↵John Ericson
remove-storetype-delegate-regStore
2020-09-03Merge remote-tracking branch 'upstream/master' into single-ca-drv-buildJohn Ericson
2020-09-03addPermRoot(): Remove indirect flagEelco Dolstra
2020-08-20Rename drv output querying functions, like masterJohn Ericson
- `queryDerivationOutputMapAssumeTotal` -> `queryPartialDerivationOutputMap` - `queryDerivationOutputMapAssumeTotal` -> `queryDerivationOutputMap
2020-08-20Merge pull request #3859 from obsidiansystems/drv-outputs-map-allow-missingEelco Dolstra
`queryDerivationOutputMap` no longer assumes all outputs have a mapping