aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
AgeCommit message (Collapse)Author
2021-06-23Apply OS checks to host platform, not buildAlyssa Ross
Previously, the build system used uname(1) output when it wanted to check the operating system it was being built for, which meant that it didn't take into-account cross-compilation when the build and host operating systems were different. To fix this, instead of consulting uname output, we consult the host triple, specifically the third "kernel" part. For "kernel"s with stable ABIs, like Linux or Cygwin, we can use a simple ifeq to test whether we're compiling for that system, but for other platforms, like Darwin, FreeBSD, or Solaris, we have to use a more complicated check to take into account the version numbers at the end of the "kernel"s. I couldn't find a way to just strip these version numbers in GNU Make without shelling out, which would be even more ugly IMO. Because these checks differ between kernels, and the patsubst ones are quite fiddly, I've added variables for each host OS we might want to check to make them easier to reuse.
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-06-01Merge pull request #4866 from alyssais/libdlEelco Dolstra
Only link with libdl on Linux
2021-06-01Merge pull request #4734 from p01arst0rm/fix-s3-ifdefEelco Dolstra
unified macro style for ENABLE_S3
2021-06-01Only link with libdl on LinuxAlyssa Ross
Linux is (as far as I know) the only mainstream operating system that requires linking with libdl for dlopen. On BSD, libdl doesn't exist, so on non-FreeBSD BSDs linking will currently fail. On macOS, it's apparently just a symlink to libSystem (macOS libc), presumably present for compatibility with things that assume Linux. So the right thing to do here is to only add -ldl on Linux, not to add it for everything that isn't FreeBSD.
2021-05-26Remove the remaining occurenceses of a NarHash moduloregnat
2021-05-25Make the Nar hash non moduloregnat
It makes much more sense to have the Nar hash be a plain straight hash rather than a hash modulo
2021-05-19Extract a generic `computeClosure` functionregnat
Move the `closure` logic of `computeFSClosure` to its own (templated) function. This doesn’t bring much by itself (except for the ability to properly test the “closure” functionality independently from the rest), but it allows reusing it (in particular for the realisations which will require a very similar closure computation)
2021-05-17Merge pull request #4818 from NixOS/ca/cli-use-builtpathsEelco Dolstra
Enforce the use of properly built paths in libcmd
2021-05-17Enfore the use of properly built paths in libcmdregnat
Replace `DerivedPathWithHints` by a new `BuiltPath` type that serves as a proof that the corresponding path has been built.
2021-05-17sandbox: allow SystemVersionCompat.plist on DarwinEmily
For whatever reason, many programs trying to access SystemVersion.plist also open SystemVersionCompat.plist; this includes Python code and coreutils’ `cat(1)` (but not the native macOS `/bin/cat`). Illustratory `dtruss(1m)` output: open("/System/Library/CoreServices/SystemVersion.plist\0", 0x0, 0x0) = 3 0 open("/System/Library/CoreServices/SystemVersionCompat.plist\0", 0x0, 0x0) = 4 0 I assume this is a Big Sur change relating to the 10.16.x/11.x version compatibility divide and that it’s something along the lines of a hook inside libSystem. Fixes a lot of sandboxed package builds under Big Sur.
2021-05-13Merge pull request #4798 from matthewbauer/relock-wait-for-build-slot-goalsEelco Dolstra
Relock wait for build slot goals
2021-05-13Merge pull request #4801 from matthewbauer/fix-tokenize-output-namesEelco Dolstra
Fix tokenize output names in DerivedPath
2021-05-12Fix tokenize output names in drvMatthew Bauer
This should fix the issue described in https://discourse.nixos.org/t/derivation-does-not-have-wanted-outputs-dev-out/12905. Specifically, we get an error of error: derivation '/nix/store/_.drv' does not have wanted outputs 'dev,out' when a path like /nix/store/_.drv!dev,out is sent to the daemon.
2021-05-12Relock wait for build slot goalsMatthew Bauer
When we don’t have enough free job slots to run a goal, we put it in the waitForBuildSlot list & unlock its output locks. This will continue from where we left off (tryLocalBuild). However, we need the locks to get reacquired when/if the goal ever restarts. So, we need to send it back through tryToBuild to get reqacquire those locks. I think this bug was introduced in https://github.com/NixOS/nix/pull/4570. It leads to some builds starting without proper locks.
2021-05-12DerivedPathWithHints -> BuiltPathregnat
Just a renaming for now
2021-05-12doc: mention Priority for substitutersLorenzo Manacorda
2021-05-10Merge pull request #4781 from NixOS/locally_cache_the_remote_realisationsEelco Dolstra
Add a realisations disk cache
2021-05-10Simplify the realisations disk cacheregnat
2021-05-10Remove useless parentsregnat
I never remember the exact syntax of the `switch` statement
2021-05-06Add a realisations disk cacheregnat
Similar to the nar-info disk cache (and using the same db). This makes rebuilds muuch faster. - This works regardless of the ca-derivations experimental feature. I could modify the logic to not touch the db if the flag isn’t there, but given that this is a trash-able local cache, it doesn’t seem to be really worth it. - We could unify the `NARs` and `Realisation` tables to only have one generic kv table. This is left as an exercise to the reader. - I didn’t update the cache db version number as the new schema just adds a new table to the previous one, so the db will be transparently migrated and is backwards-compatible. Fix #4746
2021-05-05Properly normalize the content-addressed pathsregnat
Make sure that their timestamp are always normalized. Otherwise, strange − and non-deterministic − things might happen, like https://github.com/NixOS/nixpkgs/issues/121813 Fix #4775
2021-05-04Fix the double-slash in the realisations pathregnat
Make sure that we always access the realisations under `binaryCacheUrl/realisations` and not `binaryCacheUrl//realisations` Fix #4766
2021-05-03Merge pull request #4761 from ↵Eelco Dolstra
emilazy/issue-4658-mark-impure-host-deps-as-optional Mark `__impureHostDeps` paths as optional
2021-05-03Bump version number for `DerivedPath` changesMaximilian Bosch
I guess I misunderstood John's initial explanation about why wildcards for outputs are sent to older stores[1]. My `nix-daemon` from 2021-03-26 also has version 1.29, but misses the wildcard[2]. So bumping seems to be the right call. [1] https://github.com/NixOS/nix/pull/4759#issuecomment-830812464 [2] 255d145ba7ac907d1cba8d088da556b591627756
2021-05-02Mark `__impureHostDeps` paths as optionalEmily
Starting in macOS 11, the on-disk dylib bundles are no longer available, but nixpkgs needs to be able to keep compatibility with older versions that require `/usr/lib/libSystem.B.dylib` in `__impureHostDeps`. Allow it to keep backwards compatibility with these versions by marking these dependencies as optional. Fixes #4658.
2021-04-23Merge branch 'remove-trailing-spaces' of github.com:NixOS/nixEelco Dolstra
2021-04-23Replace the trailing markdown spaces by a backslashregnat
They are equivalent according to <https://spec.commonmark.org/0.29/#hard-line-breaks>, and the trailing spaces tend to be a pain (because the make git complain, editors tend to want to remove them − the `.editorconfig` actually specifies that − etc..).
2021-04-23unified macro style for ENABLE_S3p01arst0rm
2021-04-22Always register the realisations of input-addressed drvsregnat
Fix #4725
2021-04-19Include sys/wait.h everywhere WIFEXITED etc is usedAlyssa Ross
This is required on NetBSD, and I think FreeBSD too.
2021-04-15Merge branch 'libarchive-decompress' of https://github.com/serokell/nixEelco Dolstra
2021-04-13Fix registerDrvOutput with the daemonregnat
Resolve a protocol issue that caused the daemon to endlessly wait for some information that the client doesn't ever send
2021-04-09add tests for zstd compressionDomen Kožar
2021-04-07restoreSignals() + restoreAffinity() -> restoreProcessContext()Eelco Dolstra
2021-04-07PathSubstitutionGoal: Clean up pipeEelco Dolstra
If there were many top-level goals (which are not destroyed until the very end), commands like $ nix copy --to 'ssh://localhost?remote-store=/tmp/nix' \ /run/current-system --no-check-sigs --substitute-on-destination could fail with "Too many open files". So now we do some explicit cleanup from amDone(). It would be cleaner to separate goals from their temporary internal state, but that would be a bigger refactor.
2021-04-05Document the derived path types.John Ericson
2021-04-05buildable.{cc,hh} -> derived-path.{cc,hh}John Ericson
2021-04-05Make `DerivedPathWithHints` a newtypeJohn Ericson
This allows us to namespace its constructors under it.
2021-04-05Rename BuildableJohn Ericson
2021-04-05"newtype" BuildableReqJohn Ericson
This makes for better types errors and allows us to give it methods.
2021-04-05No templates for `Buildable` and `BuildableReq`John Ericson
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-04-05Pull out Buildable into its own file/header in libnixstoreJohn Ericson
2021-03-26LocalBinaryCacheStore::upsertFile(): Fix raceEelco Dolstra
When multiple threads try to upsert the same file, this could fail. Fixes #4667.
2021-03-26Fix some typosEelco Dolstra
Fixes #4671.
2021-03-23Merge pull request #4603 from DavHau/davhau-improve-nix-conf-help-buildersEelco Dolstra
improve man page for nix.conf (builders)
2021-03-23nix.conf builders: refer to manual pageDavHau