aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/parsed-derivations.cc
AgeCommit message (Collapse)Author
2024-03-04Merge pull request #8047 from lovesegfault/always-allow-substituteseldritch horrors
feat: add always-allow-substitutes (cherry picked from commit da2b59a08878b3c6c7074595e3b6d26b6928b4c1) Change-Id: I50481cd8fe643c673c610fec28bad84519a4d650
2022-11-29Merge pull request #3600 from NixOS/auto-uid-allocationEelco Dolstra
Automatic UID allocation
2022-11-16Replace src/libutil/json.cc with nlohmann json generationYorick van Pelt
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-03-18Generalize `DerivationType` in preparation for impure derivationsJohn Ericson
2022-01-27convert a for more utilities to string_viewpennae
2021-07-12StyleEelco Dolstra
2021-07-12Merge branch 'master' into structured-attrs-shellMaximilian Bosch
Conflicts: src/nix/develop.cc src/nix/get-env.sh tests/shell.nix
2021-06-24Perform input rewrites only in LocalDerivationGoalMaximilian Bosch
2021-06-22Move `writeStructuredAttrsShell` out of `ParsedDerivation` classMaximilian Bosch
2021-06-22Split shell & json creation for build environments with structured attrsMaximilian Bosch
2021-06-22Source complete env in `nix-shell` with `__structuredAttrs = true;`Maximilian Bosch
This is needed to push the adoption of structured attrs[1] forward. It's now checked if a `__json` exists in the environment-map of the derivation to be openend in a `nix-shell`. Derivations with structured attributes enabled also make use of a file named `.attrs.json` containing every environment variable represented as JSON which is useful for e.g. `exportReferencesGraph`[2]. To provide an environment similar to the build sandbox, `nix-shell` now adds a `.attrs.json` to `cwd` (which is mostly equal to the one in the build sandbox) and removes it using an exit hook when closing the shell. To avoid leaking internals of the build-process to the `nix-shell`, the entire logic to generate JSON and shell code for structured attrs was moved into the `ParsedDerivation` class. [1] https://nixos.mayflower.consulting/blog/2020/01/20/structured-attrs/ [2] https://nixos.org/manual/nix/unstable/expressions/advanced-attributes.html#advanced-attributes
2021-06-11Add a ca-derivations required machine featureregnat
Make ca-derivations require a `ca-derivations` machine feature, and ca-aware builders expose it. That way, a network of builders can mix ca-aware and non-ca-aware machines, and the scheduler will send them in the right place.
2021-01-12Don't let 'preferLocalBuild' override 'max-jobs=0'Rickard Nilsson
This resolves #3810 by changing the behavior of `max-jobs = 0`, so that specifying the option also avoids local building of derivations with the attribute `preferLocalBuild = true`.
2020-08-12Make `system-features` a store settingJohn Ericson
This seems more correct. It also means one can specify the features a store should support with --store and remote-store=..., which is useful. I use this to clean up the build remotes test.
2020-07-22Parse CA derivations using new output variantsJohn Ericson
We no longer need `ParsedDerivation` because everything libstore needs to know about is in the `BasicDerivation` proper.
2020-06-17Reserve the `__contentAddressed` derivation parameterregnat
Not implementing anything here, just throwing an error if a derivation sets `__contentAddressed = true` without `--experimental-features content-addressed-paths` (and also with it as there's nothing implemented yet)
2020-06-16Remove StorePath::clone() and related functionsEelco Dolstra
2020-03-24Misc changes from the flakes branchEelco Dolstra
2019-12-10Make the Store API more type-safeEelco Dolstra
Most functions now take a StorePath argument rather than a Path (which is just an alias for std::string). The StorePath constructor ensures that the path is syntactically correct (i.e. it looks like <store-dir>/<base32-hash>-<name>). Similarly, functions like buildPaths() now take a StorePathWithOutputs, rather than abusing Path by adding a '!<outputs>' suffix. Note that the StorePath type is implemented in Rust. This involves some hackery to allow Rust values to be used directly in C++, via a helper type whose destructor calls the Rust type's drop() function. The main issue is the dynamic nature of C++ move semantics: after we have moved a Rust value, we should not call the drop function on the original value. So when we move a value, we set the original value to bitwise zero, and the destructor only calls drop() if the value is not bitwise zero. This should be sufficient for most types. Also lots of minor cleanups to the C++ API to make it more modern (e.g. using std::optional and std::string_view in some places).
2019-09-03Support allowSubstitutes attribute in structured attribute derivationsEelco Dolstra
Hopefully fixes #3081 (didn't test).
2019-03-14experimental/optional -> optionalEelco Dolstra
2018-09-28Check requiredSystemFeatures for local buildsEelco Dolstra
For example, this prevents a "kvm" build on machines that don't have KVM. Fixes #2012.
2018-09-28Move structured attrs handling into a separate classEelco Dolstra
This is primarily because Derivation::{can,will}BuildLocally() depends on attributes like preferLocalBuild and requiredSystemFeatures, but it can't handle them properly because it doesn't have access to the structured attributes.