aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
AgeCommit message (Collapse)Author
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-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-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-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-03Use posix_spawn_setbinpref_np to advise which architecture to runMatthew Bauer
When running universal binaries like /bin/bash, Darwin XNU will choose which architecture of the binary to use based on "binary preferences". This change sets that to the current platform for aarch64 and x86_64 builds. In addition it now uses posix_spawn instead of the usual execve. Note, that this does not prevent the other architecture from being run, just advises which to use. Unfortunately, posix_spawnattr_setbinpref_np does not appear to be inherited by child processes in x86_64 Rosetta 2 translations, meaning that this will not always work as expected. For example: { arm = derivation { name = "test"; system = "aarch64-darwin"; builder = "/bin/bash"; args = [ "-e" (builtins.toFile "test" '' set -x /usr/sbin/sysctl sysctl.proc_translated /usr/sbin/sysctl sysctl.proc_native [ "$(/usr/bin/arch)" = arm64 ] /usr/bin/touch $out '') ]; }; rosetta = derivation { name = "test"; system = "x86_64-darwin"; builder = "/bin/bash"; args = [ "-e" (builtins.toFile "test" '' set -x /usr/sbin/sysctl sysctl.proc_translated /usr/sbin/sysctl sysctl.proc_native [ "$(/usr/bin/arch)" = i386 ] echo It works! /usr/bin/touch $out '') ]; }; } `arm' fails on x86_64-compiled Nix, but `arm' and `rosetta' succeed on aarch64-compiled Nix. I suspect there is a way to fix this since: $ /usr/bin/arch -arch x86_64 /bin/bash \ -c '/usr/bin/arch -arch arm64e /bin/bash -c /usr/bin/arch' arm64 seems to work correctly. We may need to wait for Apple to update system_cmds in opensource.apple.com to find out how though.
2020-12-03Add extraPlatforms for Rosetta 2 macOSMatthew Bauer
macOS systems with ARM64 can utilize a translation layer at /Library/Apple/usr/libexec/oah to run x86_64 binaries. This change makes Nix recognize that and it to "extra-platforms". Note that there are two cases here since Nix could be built for either x86_64 or aarch64. In either case, we can switch to the other architecture. Unfortunately there is not a good way to prevent aarch64 binaries from being run in x86_64 contexts or vice versa - programs can always execute programs for the other architecture.
2020-12-03Don't fail early when -j0 is passedregnat
If the build closure contains some CA derivations, then we can't know ahead-of-time that we won't build anything as early-cutoff might come-in at a laster stage
2020-12-02fix tokens documentationGreg Hale
2020-12-02read(): Use char * instead of unsigned char *Eelco Dolstra
This gets rid of some pointless casts.
2020-12-02Sink: Use std::string_viewEelco Dolstra
2020-12-01Merge pull request #4284 from tweag/fixed-output-depending-on-caEelco Dolstra
Allow fixed-output derivations to depend on (floating) content-addressed ones
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-12-01Move primeCache() to Worker::run()Eelco Dolstra
We need the missing path info to communicate the worker's remaining goals to the progress bar.
2020-11-27Allow fixed-output derivations to depend on (floating) content-addressed onesregnat
Fix an overlook of https://github.com/NixOS/nix/pull/4056
2020-11-25fix the hash rewriting for ca-derivationsregnat
2020-11-19Make drv hash modulo memo table thread-safeJohn Ericson
Let's get one step closer to the daemon not needing to fork.
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-17Fix deadlock in IFD through the daemonEelco Dolstra
Fixes #4235.
2020-11-17Make the sql debug statements more usefulregnat
Print the expanded sql query (with the variables bound to their value) rather than the original one in case of error
2020-11-16Fix deadlock in nix-store when max-connections=1Jake Waksbaum
This fixes a bug I encountered where `nix-store -qR` will deadlock when the `--include-outputs` flag is passed and `max-connections=1`. The deadlock occurs because `RemoteStore::queryDerivationOutputs` takes the only connection from the connection pool and uses it to check the daemon version. If the version is new enough, it calls `Store::queryDerivationOutputs`, which eventually calls `RemoteStore::queryPartialDerivationOutputMap`, where we take another connection from the connection pool to check the version again. Because we still haven't released the connection from the caller, this waits for a connection to be available, causing a deadlock. This diff solves the issue by using `getProtocol` to check the protocol version in the caller `RemoteStore::queryDerivationOutputs`, which immediately frees the connection back to the pool before returning the protocol version. That way we've already freed the connection by the time we call `RemoteStore::queryPartialDerivationOutputMap`.
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-11-03LocalStore: Get rid of recursive_mutexEelco Dolstra
2020-11-03Add FIXMEEelco Dolstra
2020-11-02Don't use readDerivation() in addValidPath()Eelco Dolstra
readDerivation() requires a valid path. Fixes #4210.
2020-11-02Merge pull request #4207 from hercules-ci/fix-RemoteStore-filterSource-deadlockEelco Dolstra
Fix RemoteStore pool deadlock in filterSource etc
2020-11-02Don't send eval-related settings to the daemonEelco Dolstra
2020-10-31Restore RestrictedStore.addToStoreFromDump implementationRobert Hensing
It was accidentally removed in commit ca30abb3fb36440e5a13161c39647189036fc18f
2020-10-30Fix RemoteStore pool deadlock in filterSource etcRobert Hensing
2020-10-29Generalize extra-* settingsEelco Dolstra
This removes the extra-substituters and extra-sandbox-paths settings and instead makes every array setting extensible by setting "extra-<name> = <value>" in the configuration file or passing "--<name> <value>" on the command line.
2020-10-29Alter "wanted:" to "specified:" in hash mismatch outputstev
This makes it even clearer which of the two hashes was specified in the nix files. Some may think that "wanted" and "got" is obvious, but: "got" could mean "got in nix file" and "wanted" could mean "want to see in nix file".
2020-10-27Merge pull request #4056 from tweag/non-ca-depending-on-caEelco Dolstra
Allow non-CA derivations to depend on CA ones
2020-10-27Inline `unkownHashes`regnat
See https://github.com/NixOS/nix/pull/4056#discussion_r493661632
2020-10-27Allow non-CA derivations to depend on CA derivationsregnat
2020-10-21Add NIX_CONFIG env var for applying nix.conf overridesChristian Kampka
2020-10-18Merge pull request #4143 from obsidiansystems/typed-goal-mapsEelco Dolstra
Properly type the derivation and substitution goal maps
2020-10-18DerivationGoal: only retry if output closure incomplete is only problemRobert Hensing
2020-10-18TypoRobert Hensing
2020-10-17Explain that `upcast_goal` is still a static castJohn Ericson
2020-10-17Just use `auto` in two places.John Ericson
2020-10-17tab -> spaceJohn Ericson
2020-10-14Merge remote-tracking branch 'upstream/master' into typed-goal-mapsJohn Ericson
2020-10-14Create /etc/passwd *after* figuring out the sandbox uid/gidEelco Dolstra
Fixes build failures like # nix log /nix/store/gjaa0psfcmqvw7ivggsncx9w364p3s8s-sshd.conf-validated.drv No user exists for uid 30012
2020-10-13Add some more docsJohn Ericson
2020-10-13Merge remote-tracking branch 'upstream/master' into typed-goal-mapsJohn Ericson
2020-10-13Merge branch 'split_build_cc' of https://github.com/obsidiansystems/nixEelco Dolstra