aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
AgeCommit message (Collapse)Author
2023-01-11Split `OutputsSpec` and `ExtendedOutputsSpec`, use the former moreJohn Ericson
`DerivedPath::Built` and `DerivationGoal` were previously using a regular set with the convention that the empty set means all outputs. But it is easy to forget about this rule when processing those sets. Using `OutputSpec` forces us to get it right.
2023-01-11Rename `OutputPath` -> `ExtendedOutputPath`John Ericson
Do this prior to making a new more limitted `OutputPath` we will use in more places.
2023-01-11Improve `OutputsSpec` slightlyJohn Ericson
A few little changes preparing for the rest.
2023-01-11Merge pull request #7543 from obsidiansystems/typed-string-contextThéophane Hufschmitt
Parse string context elements properly
2023-01-10doc/manual: Introduce @docroot@ as a stable base for includable snippetsRobert Hensing
This way the links are clearly within the manual (ie not absolute paths), while allowing snippets to reference the documentation root reliably, regardless of at which base url they're included.
2023-01-10Make clear that `StorePathWithOutputs` is a deprecated typeJohn Ericson
- Add a comment - Put `OutputsSpec` in a different header (First part of #6815) - Make a few stray uses of it in new code use `DerivedPath` instead.
2023-01-06Merge pull request #7307 from hercules-ci/derivation-goal-improve-commentThéophane Hufschmitt
libstore/derivation-goal: Elaborate a TODO for performance concern
2023-01-06Merge pull request #7557 from NixOS/fix-7529Eelco Dolstra
On macOS with auto-uid-allocation and sandboxing, use the correct gid
2023-01-05Merge pull request #7542 from edolstra/gc-deadlockEelco Dolstra
Fix deadlock between auto-GC and addTempRoot()
2023-01-05Merge pull request #7539 from tweag/fix-nix-why-depends--derivationEelco Dolstra
Fix `nix why-depends --derivation`
2023-01-05On macOS with auto-uid-allocation and sandboxing, use the correct gidEelco Dolstra
macOS doesn't have user namespacing, so the gid of the builder needs to be nixbld. The logic got "has sandboxing enabled" confused with "has user namespaces". Fixes #7529.
2023-01-04Move macOS sandbox files to sr/libstore/buildEelco Dolstra
2023-01-04Include macOS sandbox files in the Nix binaryEelco Dolstra
This basically reverts 6e5165b77370c76bfa39d4b55e9f83673f3bd466. It fixes errors like sandbox-exec: <internal init prelude>:292:47: unable to open sandbox-minimal.sb: not found when trying to run a development Nix installed in a user's home directory. Also, we're trying to minimize the number of installed files to make it possible to deploy Nix as a single statically-linked binary.
2023-01-03Fix deadlock between auto-GC and addTempRoot()Eelco Dolstra
Previously addTempRoot() acquired the LocalStore state lock and waited for the garbage collector to reply. If the garbage collector is in the same process (as it the case with auto-GC), this would deadlock as soon as the garbage collector thread needs the LocalStore state lock. So now addTempRoot() uses separate Syncs for the state that it needs. As long at the auto-GC thread doesn't call addTempRoot() (which it shouldn't), it shouldn't deadlock. Fixes #3224.
2023-01-03Move creation of the temp roots file into its own functionEelco Dolstra
This also moves the file handle into its own Sync object so we're not holding the _state while acquiring the file lock. There was no real deadlock risk here since locking a newly created file cannot block, but it's still a bit nicer.
2023-01-03Merge pull request #7497 from rski/masterEelco Dolstra
src/libstore: Print the reason opening the DB failed
2023-01-02Fix why-depends for CA derivations (again)Théophane Hufschmitt
This has the same goal as b13fd4c58e81b2b2b0d72caa5ce80de861622610,but achieves it in a different way in order to not break `nix why-depends --derivation`.
2023-01-02Merge pull request #7478 from hercules-ci/make-sure-initNix-calledThéophane Hufschmitt
libstore: Make sure that initNix has been called
2023-01-02Merge pull request #7521 from ncfavier/migration-deadlockThéophane Hufschmitt
Release shared lock before acquiring exclusive lock
2023-01-01Fix error messageSteven Shaw
2022-12-29Merge pull request #7524 from ncfavier/sandbox-paths-closureEelco Dolstra
doc: sandbox-paths computes closures
2022-12-28doc: sandbox-paths computes closuresNaïm Favier
2022-12-27Release shared lock before acquiring exclusive lockNaïm Favier
In principle, this should avoid deadlocks where two instances of Nix are holding a shared lock on big-lock and are both waiting to get an exclusive lock. However, it seems like `flock(2)` is supposed to do this automatically, so it's not clear whether this is actually where the problem comes from.
2022-12-24libstore: Make sure that initNix has been calledRobert Hensing
Prevent bugs like https://github.com/cachix/cachix/pull/477
2022-12-23nix develop: Set personalityEelco Dolstra
This makes 'nix develop' set the Linux personality in the same way that the actual build does, allowing a command like 'nix develop nix#devShells.i686-linux.default' on x86_64-linux to work correctly.
2022-12-23src/libstore: Print the reason opening the DB failedrski
Without this, the error is lost, and it makes for a hard to debug situation. Also remove some of the busyness inside the sqlite_open_v2 args. The errcode returned is not the extended one. The only way to make open return an extended code, would be to add SQLITE_OPEN_EXRESCODE to the flags. In the future it might be worth making this change, which would also simplify the existing SQLiteError code.
2022-12-21[PDT] TDE-3114: prevent a race-condition when creating the S3 cachemupdt
2022-12-17Improve sqlite error messagesRobert Hensing
They did not include the detailed error message, losing essential information for troubleshooting. Example message: warning: creating statement 'insert or rplace into NARs(cache, hashPart, namePart, url, compression, fileHash, fileSize, narHash, narSize, refs, deriver, sigs, ca, timestamp, present) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1)': at offset 10: SQL logic error, near "rplace": syntax error (in '/tmp/nix-shell.grQ6f7/nix-test/tests/binary-cache/test-home/.cache/nix/binary-cache-v6.sqlite') It's not the best example; more important information will be in the message for e.g. a constraint violation. I don't see why this specific error is printed as a warning, but that's for another commit.
2022-12-15Fix a crash in DerivedPath::Built::toJSON() with impure derivationsEelco Dolstra
The use of 'nullptr' here didn't result in a null JSON value, but in a nullptr being cast to a string, which aborts.
2022-12-14Allow disabling build users by unsetting `build-users-group`Naïm Favier
Unsetting `build-users-group` (without `auto-allocate-uids` enabled) gives the following error: ``` src/libstore/lock.cc:25: static std::unique_ptr<nix::UserLock> nix::SimpleUserLock::acquire(): Assertion `settings.buildUsersGroup != ""' failed. ``` Fix the logic in `useBuildUsers` and document the default value for `build-users-group`.
2022-12-12Merge remote-tracking branch 'upstream/master' into indexed-store-path-outputsJohn Ericson
2022-12-12Merge remote-tracking branch 'upstream/master' into indexed-store-path-outputsJohn Ericson
2022-12-12Apply suggestions from code reviewJohn Ericson
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
2022-12-12Move isUri() and resolveUri() out of filetransfer.ccEelco Dolstra
These are purely related to NIX_PATH / -I command line parsing, so put them in libexpr.
2022-12-12Merge pull request #7421 from edolstra/lazy-trees-trivial-changesEelco Dolstra
Trivial changes from the lazy-trees branch
2022-12-12Merge branch 'master' into indexed-store-path-outputsJohn Ericson
2022-12-09Merge pull request #7409 from tweag/fix-6383Théophane Hufschmitt
check the store for input before failing (hopefully fix #6383)
2022-12-07Trivial changes from the lazy-trees branchEelco Dolstra
2022-12-07Remove repeat and enforce-determinism optionsLinus Heckemann
These only functioned if a very narrow combination of conditions held: - The result path does not yet exist (--check did not result in repeated builds), AND - The result path is not available from any configured substituters, AND - No remote builders that can build the path are available. If any of these do not hold, a derivation would be built 0 or 1 times regardless of the repeat option. Thus, remove it to avoid confusion.
2022-12-06improve styleTaeer Bar-Yam
2022-12-06Merge pull request #7382 from fricklerhandwerk/doc-automatic-uidEelco Dolstra
move documentation on `auto-allocate-uids` to options docs
2022-12-06Tweak option descriptionsEelco Dolstra
2022-12-05check the store for input before failing (hopefully fix #6383)Taeer Bar-Yam
2022-12-05check the store for input before failing (hopefully fix #6700)Taeer Bar-Yam
2022-12-02Clean up cgroup handling in getMaxCPU()Eelco Dolstra
Also, don't assume in LocalDerivationGoal that cgroups are mounted on /sys/fs/cgroup.
2022-12-02Move cgroup.{cc,hh} to libutilEelco Dolstra
2022-12-01move documentation on `auto-allocate-uids` to options docsValentin Gagarin
this is where it belongs and can be found together with the other options.
2022-11-29Merge pull request #3600 from NixOS/auto-uid-allocationEelco Dolstra
Automatic UID allocation
2022-11-29Restore ownership of / for non-uid-range buildsEelco Dolstra
2022-11-28Add a setting for enabling cgroupsEelco Dolstra