aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build
AgeCommit message (Collapse)Author
2023-01-13Merge pull request #7430 from tweag/ca/fix-nix-logThéophane Hufschmitt
Ca/fix nix log
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-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.
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-15getBuildLog: factor out resolving derivationsTaeer Bar-Yam
2022-12-12Merge pull request #7421 from edolstra/lazy-trees-trivial-changesEelco Dolstra
Trivial changes from the lazy-trees branch
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-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-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
2022-11-28Merge pull request #7313 from yorickvP/nlohmann-everywhereEelco Dolstra
Replace src/libutil/json.cc with nlohmann
2022-11-23Merge remote-tracking branch 'origin/master' into auto-uid-allocationEelco Dolstra
2022-11-22Always call setgroups()Eelco Dolstra
We shouldn't skip this if the supplementary group list is empty, because then the sandbox won't drop the supplementary groups of the parent (like "root").
2022-11-21Merge pull request #6456 from amjoseph-nixpkgs/seccomp-mipsEelco Dolstra
local-derivation-goal.cc: enable seccomp filters for mips{32,64}
2022-11-21AutoUserLock: If sandboxing is disabled, use the build users groupEelco Dolstra
We have to use a gid that has write access to the Nix store.
2022-11-21Fix macOS buildEelco Dolstra
2022-11-21Merge remote-tracking branch 'origin/master' into auto-uid-allocationEelco Dolstra
2022-11-18Get CPU stats from the cgroupEelco Dolstra
2022-11-18Separate cgroup support from auto-uid-allocationEelco Dolstra
The new experimental feature 'cgroups' enables the use of cgroups for all builds. This allows better containment and enables setting resource limits and getting some build stats.
2022-11-17Fix segfault in unprivileged modeEelco Dolstra
2022-11-16Replace src/libutil/json.cc with nlohmann json generationYorick van Pelt
2022-11-15libstore/derivation-goal: Elaborate a TODO for performance concernRobert Hensing
2022-11-14derivation-goal: Fix `requires non-existing output` errorRobert Hensing
It occurred when a output of the dependency was already available, so it didn't need rebuilding and didn't get added to the inputDrvOutputs. This process-related info wasn't suitable for the purpose of finding the actual input paths for the builder. It is better to do this in absolute terms by querying the store.
2022-11-10Remove the SystemdCgroup featureEelco Dolstra
2022-11-08Fix build on macOSEelco Dolstra
2022-11-08Split auto UID allocation from cgroupsEelco Dolstra
Cgroups are now only used for derivations that require the uid-range range feature. This allows auto UID allocation even on systems that don't have cgroups (like macOS). Also, make things work on modern systems that use cgroups v2 (where there is a single hierarchy and no "systemd" controller).
2022-11-03Merge remote-tracking branch 'origin/master' into auto-uid-allocationEelco Dolstra
2022-10-27Pass the right argv when calling the build hookThéophane Hufschmitt
Call it as `['nix', '__build-remote', ... ]` rather than the previous `["__build-remote", "nix __build-remote", ... ]` which seemed to have been most likely unintended
2022-10-13Fix error display if execve() in the builder failsEelco Dolstra
After we've send "\2\n" to the parent, we can't send a serialized exception anymore. It will show up garbled like $ nix-build --store /tmp/nix --expr 'derivation { name = "foo"; system = "x86_64-linux"; builder = "/foo/bar"; }' this derivation will be built: /nix/store/xmdip0z5x1zqpp6gnxld3vqng7zbpapp-foo.drv building '/nix/store/xmdip0z5x1zqpp6gnxld3vqng7zbpapp-foo.drv'... ErrorErrorEexecuting '/foo/bar': No such file or directory error: builder for '/nix/store/xmdip0z5x1zqpp6gnxld3vqng7zbpapp-foo.drv' failed with exit code 1
2022-09-02Don’t readDerivation if impure derivations feature is disabledMatthew Bauer
readDerivation is pretty slow, and while it may not be significant for some use cases, on things like ghc-nix where we have thousands of derivations is really slows things down. So, this just doesn’t do the impure derivation check if the impure derivation experimental feature is disabled. Perhaps we could cache the result of isPure() and keep the check, but this is a quick fix to for the slowdown introduced with impure derivations features in 2.8.0.
2022-08-19don't read outputs into memory for output rewritingpennae
RewritingSink can handle being fed input where a reference crosses a chunk boundary. we don't need to load the whole source into memory, and in fact *not* loading the whole source lets nix build FODs that do not fit into memory (eg fetchurl'ing data files larger than system memory).
2022-08-10Merge pull request #6850 from NinjaTrappeur/nin/build-checkThéophane Hufschmitt
Fix Nix build --check flag
2022-08-03moveFile -> renameFileThéophane Hufschmitt
`move` tends to have this `mv` connotation of “I will copy it for you if needs be”
2022-08-03Create a wrapper around stdlib’s `rename`Théophane Hufschmitt
Directly takes some c++ strings, and gently throws an exception on error (rather than having to inline this logic everywhere)
2022-08-01derivation-goal.cc: remove bmCheck custom return branch on buildDoneFélix Baylac-Jacqué
Once a derivation goal has been completed, we check whether or not this goal was meant to be repeated to check its output. An early return branch was preventing the worker to reach that repeat code branch, hence breaking the --check command (#2619). It seems like this early return branch is an artifact of a passed refactoring. As far as I can tell, buildDone's main branch also cleanup the tmp directory before returning.
2022-07-19local-derivation-goal.cc: save global errno to the stack before performing ↵Adam Joseph
tests which might clobber it
2022-07-19as requested by @thufschmitt ↵Adam Joseph
https://github.com/NixOS/nix/pull/6814#discussion_r924275777
2022-07-19change warn() to notice()Adam Joseph
2022-07-17local-derivation-goal.cc: detect unprivileged_userns_clone failure modeAdam Joseph
The workaround for "Some distros patch Linux" mentioned in local-derivation-goal.cc will not help in the `--option sandbox-fallback false` case. To provide the user more helpful guidance on how to get the sandbox working, let's check to see if the `/proc` node created by the aforementioned patch is present and configured in a way that will cause us problems. If so, give the user a suggestion for how to troubleshoot the problem.
2022-07-17local-derivation-goal.cc: add comment re: CLONE_NEWUSERAdam Joseph
local-derivation-goal.cc contains a comment stating that "Some distros patch Linux to not allow unprivileged user namespaces." Let's give a pointer to a common version of this patch for those who want more details about this failure mode.
2022-07-16local-derivation-goal.cc: warn if failing and /proc/self/ns/user missingAdam Joseph
This commit causes nix to `warn()` if sandbox setup has failed and `/proc/self/ns/user` does not exist. This is usually a sign that the kernel was compiled without `CONFIG_USER_NS=y`, which is required for sandboxing.
2022-07-16local-derivation-goal.cc: warn if failing due to max_user_namespaces==0Adam Joseph
This commit uses `warn()` to notify the user if sandbox setup fails with errno==EPERM and /proc/sys/user/max_user_namespaces is missing or zero, since that is at least part of the reason why sandbox setup failed. Note that `echo -n 0 > /proc/sys/user/max_user_namespaces` or equivalent at boot time has been the recommended mitigation for several Linux LPE vulnerabilities over the past few years. Many users have applied this mitigation and then forgotten that they have done so.
2022-07-16local-derivation-goal.cc: improve error messages when sandboxing failsAdam Joseph
The failure modes for nix's sandboxing setup are pretty complicated. When nix is unable to set up the sandbox, let's provide more detail about what went wrong. Specifically: * Make sure the error message includes the word "sandbox" so the user knows that the failure was related to sandboxing. * If `--option sandbox-fallback false` was provided, and removing it would have allowed further attempts to make progress, let the user know.