Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track the dependencies of derivation outputs #4267

Closed
wants to merge 30 commits into from

Commits on Dec 1, 2020

  1. Configuration menu
    Copy the full SHA
    0e5c22a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    403fb3b View commit details
    Browse the repository at this point in the history
  3. Add a test ensuring compatibility with an old daemon

    This requires adding `nix` to its own closure which is a bit unfortunate,
    but as it is optional (the test will be disabled if `OUTER_NIX` is unset) it
    shouldn't be too much of an issue.
    
    (Ideally this should go in another derivation so that we can build Nix and run
    the test independently, but as the tests are running in the same derivation
    as the build it's a bit complicated to do so).
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    c3ad8dd View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    47f097d View commit details
    Browse the repository at this point in the history
  5. Store metadata about drv outputs

    For each “known” derivation output, store:
    - its output id
    - its output path
    
    This comes with a set of needed changes:
    
    - New `drv-output-info` 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::queryDrvOutputInfo` method to retrieve the informations for a
      derivations
    
    This introcudes some redundancy on the remote-store side between
    `wopQueryDerivationOutputMap` and `wopQueryDrvOutputInfo`.
    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.
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    ec67ea8 View commit details
    Browse the repository at this point in the history
  6. Make copyPaths work with derivation outputs

    Copying a derivation output is equivalent to copy the output path,
    except that it will also link the output to the path (with
    `linkDeriverToPath` on the remote store)
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    21bfece View commit details
    Browse the repository at this point in the history
  7. Allow /nix/store/....drv!out as a cli input

    Commands that accept store paths or installables as input can now take a
    derivation path with outputs. Like when the input is a nix expr, the
    derivation will be realised if needed.
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    30eb04a View commit details
    Browse the repository at this point in the history
  8. Add a BuildablesCommand type

    Generalises `StorePathsCommand` to allow manipulating `Buildables`
    rather than just store paths.
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    d2e6cc0 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    08fcb23 View commit details
    Browse the repository at this point in the history
  10. Add a store method for computing the closure of a drv output

    Mostly dummy atm as it just computes the closure of the output path, but
    might be extended later
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    2607da5 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    ebfdafa View commit details
    Browse the repository at this point in the history
  12. Rework the db schema for derivation outputs

    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 NixOS#4138)
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    ca27a6b View commit details
    Browse the repository at this point in the history
  13. InstallableStorePath: Don't read the derivation if there's no need

    That way we can `nix copy --from` a store that doesn't have the derivation but
    just its outputs
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    3e2201d View commit details
    Browse the repository at this point in the history
  14. Also register the outputs of the non-resolved derivation

    That way we don't need to resolve it again to know its output paths.
    In particular, this means that we don't need to keep its whole build-time
    closure
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    b646c2a View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    d9d8891 View commit details
    Browse the repository at this point in the history
  16. Better detect when buildPaths would be a no-op

    `buildPaths` can be called even for stores where it's not defined in case it's
    bound to be a no-op.
    The “no-op detection” mechanism was only detecting the case wher `buildPaths`
    was called on a set of (non-drv) paths that were already present on the store.
    
    This commit extends this mechanism to also detect the case where `buildPaths`
    is called on a set of derivation outputs which are already built on the store.
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    e51e5d2 View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    0bfcd02 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    dcb8957 View commit details
    Browse the repository at this point in the history
  19. SubstitutionGoal -> PathSubstitutionGoal

    To prepare for the upcoming DrvOutputSubstitutionGoal
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    b05ba63 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    0dde491 View commit details
    Browse the repository at this point in the history
  21. Move the CA tests to a sub-directory

    Requires a slight update to the test infra to work properly
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    6c9e183 View commit details
    Browse the repository at this point in the history
  22. Configuration menu
    Copy the full SHA
    e10741c View commit details
    Browse the repository at this point in the history
  23. Add a dependencies field to DrvOutputInfo

    Currently never used, nor set but will be useful shortly
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    2628e03 View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    d01cd98 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    52d0250 View commit details
    Browse the repository at this point in the history
  26. Configuration menu
    Copy the full SHA
    7e8f8ae View commit details
    Browse the repository at this point in the history
  27. Configuration menu
    Copy the full SHA
    258f6c9 View commit details
    Browse the repository at this point in the history
  28. Register the drv outputs in order when copying

    We need to topologically sort them like we do for the store paths, otherwise
    the registration will fail because of an incomplete closure
    thufschmitt committed Dec 1, 2020
    Configuration menu
    Copy the full SHA
    a1e7076 View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    6aef911 View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    8b8e75b View commit details
    Browse the repository at this point in the history