aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.hh
AgeCommit message (Collapse)Author
2021-10-13Remove syncWithGC()Eelco Dolstra
2021-10-13Remove trash directoryEelco Dolstra
2021-09-15Merge remote-tracking branch 'upstream/master' into auto-uid-allocationMatthew Kenigsberg
2021-06-23Properly fail when trying to register an incoherent realisationregnat
2021-06-18UDSRemoteStore: Support the 'root' store parameterEelco Dolstra
Useful when we're using a daemon with a chroot store, e.g. $ NIX_DAEMON_SOCKET_PATH=/tmp/chroot/nix/var/nix/daemon-socket/socket nix-daemon --store /tmp/chroot Then the client can now connect with $ nix build --store unix:///tmp/chroot/nix/var/nix/daemon-socket/socket?root=/tmp/chroot nixpkgs#hello
2021-06-01Check the CA hash when importing stuff in the local storeregnat
When adding a path to the local store (via `LocalStore::addToStore`), ensure that the `ca` field of the provided `ValidPathInfo` does indeed correspond to the content of the path. Otherwise any untrusted user (or any binary cache) can add arbitrary content-addressed paths to the store (as content-addressed paths don’t need a signature).
2021-04-27Merge remote-tracking branch 'upstream/master' into auto-uid-allocationJohn Ericson
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-03-01SubstitutionGoal -> PathSubstitutionGoalregnat
To prepare for the upcoming DrvOutputSubstitutionGoal
2021-02-26Split {,local-}derivation-goal.{cc,hh}John Ericson
This separates the scheduling logic (including simple hook pathway) from the local-store needing code. This should be the final split for now. I'm reasonably happy with how it's turning out, even before I'm done moving code into `local-derivation-goal`. Benefits: 1. This will help "witness" that the hook case is indeed a lot simpler, and also compensate for the increased complexity that comes from content-addressed derivation outputs. 2. It also moves us ever so slightly towards a world where we could use off-the-shelf storage or sandboxing, since `local-derivation-goal` would be gutted in those cases, but `derivation-goal` should remain nearly the same. The new `#if 0` in the new files will be deleted in the following commit. I keep it here so if it turns out more stuff can be moved over, it's easy to do so in a way that preserves ordering --- and thus prevents conflicts. N.B. ```sh git diff HEAD^^ --color-moved --find-copies-harder --patience --stat ``` makes nicer output.
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-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
2021-01-05Fix deadlock in LocalStore::addSignatures()Eelco Dolstra
Fixes #4367.
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-11Rework the db schema for derivation outputsregnat
Add a new table for tracking the derivation output mappings. We used to hijack the `DerivationOutputs` table for that, but (despite its name), it isn't a really good fit: - Its entries depend on the drv being a valid path, making it play badly with garbage collection and preventing us to copy a drv output without copying the whole drv closure too; - It dosen't guaranty that the output path exists; By using a different table, we can experiment with a different schema better suited for tracking the output mappings of CA derivations. (incidentally, this also fixes #4138)
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-12-08Hide the sqlite statements declarations for the local storeregnat
These have no need to be in the public interface and it causes spurious rebuilds each time one wants to add or remove a new statement.
2020-12-01shut up clang warningsregnat
- Fix some class/struct discrepancies - Explicit the overloading of `run` in the `Cmd*` classes - Ignore a warning in the generated lexer
2020-11-03LocalStore: Get rid of recursive_mutexEelco Dolstra
2020-11-03Add FIXMEEelco Dolstra
2020-10-17Merge remote-tracking branch 'upstream/master' into auto-uid-allocationJohn Ericson
2020-10-17Merge commit 'f66bbd8c7bb1472facf8917e58e3cd4f6ddfa1b5' into auto-uid-allocationJohn Ericson
2020-10-09Split out `local-fs-store.hh`John Ericson
This matches the already-existing `local-fs-store.cc`.
2020-09-16Add a name to the storesregnat
So that it can be printed by `nix describe-stores`
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-04Fix some of the issues raised by @edolstraJohn Ericson
- More and better comments - The easier renames
2020-08-28Merge remote-tracking branch 'upstream/master' into single-ca-drv-buildJohn Ericson
2020-08-27Merge pull request #3434 from Ericson2314/derivation-header-include-orderEelco Dolstra
Revise division of labor in deserialization of derivations
2020-08-20Rename drv output querying functions, like masterJohn Ericson
- `queryDerivationOutputMapAssumeTotal` -> `queryPartialDerivationOutputMap` - `queryDerivationOutputMapAssumeTotal` -> `queryDerivationOutputMap
2020-08-20Rename drv output querying functionsJohn Ericson
- `queryDerivationOutputMapAssumeTotal` -> `queryPartialDerivationOutputMap` - `queryDerivationOutputMapAssumeTotal` -> `queryDerivationOutputMap`
2020-08-18Merge remote-tracking branch 'upstream/master' into ↵John Ericson
derivation-header-include-order
2020-08-07Squashed get CA derivations buildingJohn Ericson
2020-08-04Merge remote-tracking branch 'upstream/master' into ↵John Ericson
drv-outputs-map-allow-missing
2020-08-03`addToStore` in terms of `addToStoreFromDump` is not local-store-specificJohn Ericson
2020-08-01Merge remote-tracking branch 'upstream/master' into ↵John Ericson
derivation-header-include-order
2020-07-31Merge branch 'master' of github.com:NixOS/nix into drv-outputs-map-allow-missingCarlo Nucera
2020-07-30Merge remote-tracking branch 'origin/master' into substitute-other-storedirMatthew Bauer
2020-07-30unsigned long long -> uint64_tEelco Dolstra
2020-07-24`queryDerivationOutputMap` no longer assumes all outputs have a mappingJohn Ericson
This assumption is broken by CA derivations. Making a PR now to do the breaking daemon change as soon as possible (if it is already too late, we can bump protocol intead).
2020-07-15Get rid of `LocalStore::addToStoreCommon`John Ericson
I got it to just become `LocalStore::addToStoreFromDump`, cleanly taking a store and then doing nothing too fancy with it. `LocalStore::addToStore(...Path...)` is now just a simple wrapper with a bare-bones sinkToSource of the right dump command.
2020-07-15Merge branch 'master' of github.com:NixOS/nix into ↵Carlo Nucera
derivation-header-include-order
2020-07-14LocalStore::addToStoreFromDump copy in chunksJohn Ericson
Rather than copying byte-by-byte, we let the coroutine know how much data we would like it to send back to us.