aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2020-12-16Don't ignore an absent drv file in queryPartialDrvOutputMapregnat
This ignore was here because `queryPartialDrvOutputMap` was used both 1. as a cache to avoid having to re-read the derivation (when gc-ing for example), and 2. as the source of truth for ca realisations The use-case 2. required it to be able to work even when the derivation wasn't there anymore (see https://github.com/NixOS/nix/issues/4138). However, this use-case is now handled by `queryRealisation`, meaning that we can safely error out if the derivation isn't there anymore
2020-12-16Merge pull request #4348 from NixOS/ca/use-hashmoduloEelco Dolstra
Use the hash modulo in the derivation outputs
2020-12-16Merge pull request #4371 from NixOS/ca/fix-remote-store-registerDrvOutputEelco Dolstra
Fix BinaryCacheStore::registerDrvOutput
2020-12-16Fix BinaryCacheStore::registerDrvOutputregnat
Was crashing because coercing a json document into a string is only valid if the json is a string, otherwise we need to call `.dump()`
2020-12-15Merge pull request #4361 from tweag/fix-binary-caches-addTextToStoreEelco Dolstra
Fix `addTextToStore` for binary caches
2020-12-15Fix `addTextToStore` for binary cachesregnat
Because of a too eager refactoring, `addTextToStore` used to throw an error because the input wasn't a valid nar. Partially revert that refactoring to wrap the text into a proper nar (using `dumpString`) to make this method work again
2020-12-14Merge pull request #4330 from NixOS/ca/properly-store-outputsEelco Dolstra
Properly store the outputs of CA derivations − take 2
2020-12-14Merge pull request #4351 from Ma27/json-errtraceEelco Dolstra
primops/fromJSON: add error position in case of parse error
2020-12-13primops/fromJSON: add error position in case of parse errorMaximilian Bosch
This makes it easier to track down where invalid JSON was passed to `builtins.fromJSON`.
2020-12-13Merge pull request #4352 from jonringer/allow-private-cachesEelco Dolstra
treat s3 permission errors as file-not-found
2020-12-11Restrict the operations on drv outputs in recursive Nixregnat
There's currently no way to properly filter them, so disallow them altogether instead.
2020-12-11Use the hash modulo in the derivation outputsregnat
Rather than storing the derivation outputs as `drvPath!outputName` internally, store them as `drvHashModulo!outputName` (or `outputHash!outputName` for fixed-output derivations). This makes the storage slightly more opaque, but enables an earlier cutoff in cases where a fixed-output dependency changes (but keeps the same output hash) − same as what we already do for input-addressed derivations.
2020-12-11Store the realisations as JSON in the binary cacheregnat
Fix #4332
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-11treat s3 permission errors as file-not-foundMichael Bishop
Signed-off-by: Jonathan Ringer <jonringer117@gmail.com>
2020-12-11Merge pull request #4350 from NixOS/ca/fix-build-with-nix-commandEelco Dolstra
Fix the `nix` command with CA derivations
2020-12-11Fix the `nix` command with CA derivationsregnat
Prevents a crash because most `nix` subcommands assumed that derivations know their output path, which isn't the case for CA derivations
2020-12-10nix store make-content-addressable: Show rewritten pathEelco Dolstra
2020-12-10Add lvlNotice log levelEelco Dolstra
This is like syslog's LOG_NOTICE: "normal, but significant, condition".
2020-12-09Merge pull request #4343 from tweag/fix-osx-ciEelco Dolstra
Use no substituers by default in the tests
2020-12-09Use no substituers by default in the testsregnat
Otherwise https://cache.nixos.org is chosen by default, causing the OSX testsuite to hang inside the sandbox. (In a way, this is probably rugging an actual bug under the carpet as Nix should be able to gracefully timeout in such a case, but that's beyond mac OSX-fu)
2020-12-09Merge pull request #4342 from tweag/fix-remote-build-hookEelco Dolstra
fix remote build hook
2020-12-09Merge pull request #4319 from Ma27/store-v6-addrEelco Dolstra
libstore/openStore: fix stores with IPv6 addresses
2020-12-09libstore/openStore: fix stores with IPv6 addressesMaximilian Bosch
In `nixStable` (2.3.7 to be precise) it's possible to connect to stores using an IPv6 address: nix ping-store --store ssh://root@2001:db8::1 This is also useful for `nixops(1)` where you could specify an IPv6 address in `deployment.targetHost`. However, this behavior is broken on `nixUnstable` and fails with the following error: $ nix store ping --store ssh://root@2001:db8::1 don't know how to open Nix store 'ssh://root@2001:db8::1' This happened because `openStore` from `libstore` uses the `parseURL` function from `libfetchers` which expects a valid URL as defined in RFC2732. However, this is unsupported by `ssh(1)`: $ nix store ping --store 'ssh://root@[2001:db8::1]' cannot connect to 'root@[2001:db8::1]' This patch now allows both ways of specifying a store (`root@2001:db8::1`) and also `root@[2001:db8::1]` since the latter one is useful to pass query parameters to the remote store. In order to achieve this, the following changes were made: * The URL regex from `url-parts.hh` now allows an IPv6 address in the form `2001:db8::1` and also `[2001:db8::1]`. * In `libstore`, a new function named `extractConnStr` ensures that a proper URL is passed to e.g. `ssh(1)`: * If a URL looks like either `[2001:db8::1]` or `root@[2001:db8::1]`, the brackets will be removed using a regex. No additional validation is done here as only strings parsed by `parseURL` are expected. * In any other case, the string will be left untouched. * The rules above only apply for `LegacySSHStore` and `SSHStore` (a.k.a `ssh://` and `ssh-ng://`). Unresolved questions: * I'm not really sure whether we want to allow both variants of IPv6 addresses in the URL parser. However it should be noted that both seem to be possible according to RFC2732: > This document incudes an update to the generic syntax for Uniform > Resource Identifiers defined in RFC 2396 [URL]. It defines a syntax > for IPv6 addresses and allows the use of "[" and "]" within a URI > explicitly for this reserved purpose. * Currently, it's not supported to specify a port number behind the hostname, however it seems as this is not really supported by the URL parser. Hence, this is probably out of scope here.
2020-12-09Store the final drv outputs in memory when building remotelyregnat
The `DerivationGoal` has a variable storing the “final” derivation output paths that is used (amongst other things) to fill the environment for the post build hook. However this variable wasn't set when the build-hook is used, causing a crash when both hooks are used together. Fix this by setting this variable (from the informations in the db) after a run of the post build hook.
2020-12-09Test the post-build-hook with remote buildersregnat
Regression test for #4245
2020-12-09Revert "Re-query for the derivation outputs in the post-build-hook"regnat
This reverts commit 1b1e0760335832c87516b9103b670b34662d5daf. Using `queryPartialDerivationOutputMap` assumes that the derivation exists locally which isn't the case for remote builders.
2020-12-08Merge pull request #4325 from tweag/hide-local-store-sql-statementsEelco Dolstra
Hide the sqlite statements declarations for the local store
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-08Merge pull request #4326 from tweag/fix-post-build-hook-and-remote-buildersEelco Dolstra
Re-query for the derivation outputs in the post-build-hook
2020-12-08Re-query for the derivation outputs in the post-build-hookregnat
We can't assume that the runtime state knows about them as they might have been built remotely, in which case we must query the db again to get them.
2020-12-07Merge pull request #4305 from matthewbauer/rosetta2-checkEelco Dolstra
Check for rosetta 2 support before installing x86_64-darwin Nix
2020-12-07Merge pull request #4321 from matthewbauer/always-default-cache-nixos-orgEelco Dolstra
Always default to cache.nixos.org even when different nix store dir
2020-12-06Always default to cache.nixos.org even when different nix store dirMatthew Bauer
Since 0744f7f, it is now useful to have cache.nixos.org in substituers even if /nix/store is not the Nix Store Dir. This can always be overridden via configuration, though.
2020-12-05Merge pull request #4318 from matthewbauer/add-slash-to-trusted-binary-cacheEelco Dolstra
Canonicalize binary caches with ‘/’ when one is missing
2020-12-05Merge pull request #4316 from stephank/aws-sdk-compatEelco Dolstra
Fix compatibility with newer AWS SDKs
2020-12-04Canonicalize binary caches with ‘/’ when one is missingMatthew Bauer
This checks if there is a trusted substituter with a slash, so trusting https://cache.nixos.org also implies https://cache.nixos.org/ is trusted.
2020-12-04Use com.apple.oahd.plist for rosetta 2 detectionMatthew Bauer
2020-12-04Fix compatibility with newer AWS SDKsStéphan Kochen
Tested against AWS SDK 1.8.99. Fixes #3201.
2020-12-04Merge pull request #4314 from tweag/less-noisy-make-docEelco Dolstra
Make `make install` less noisy
2020-12-04Make `make install` less noisyregnat
Remove the printing and useless output of a couple of commands when running `make install`
2020-12-04Merge pull request #4311 from matthewbauer/static-nix-supportEelco Dolstra
Include static "nix" binary in Hydra build products
2020-12-03Include static "nix" binary in Hydra build productsMatthew Bauer
This allows users to get Nix from Hydra via a stable url like https://hydra.nixos.org/build/132078238/download/1/nix
2020-12-04Split 'nix store add-to-store' into 'add-path' and 'add-file'Eelco Dolstra
This makes it consistent with 'nix hash <path|file>'.
2020-12-03Merge pull request #3858 from edolstra/group-commandsEelco Dolstra
Group 'nix' subcommands
2020-12-03TypoEelco Dolstra
2020-12-03Move most store-related commands to 'nix store'Eelco Dolstra
2020-12-03Add 'nix nar dump-path'Eelco Dolstra
This only differs from 'nix store dump-path' in that the path doesn't need to be a store path.
2020-12-03Add deprecated aliases for renamed commandsEelco Dolstra