aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/parsed-derivations.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2022-11-08 16:03:42 +0100
committerEelco Dolstra <edolstra@gmail.com>2022-11-08 16:03:42 +0100
commit2fde7e0108d70bcba64ebecc5e5c7ee2863e3446 (patch)
tree3cf91ee071ba96dbca851a695838ea2099ec0c96 /src/libstore/parsed-derivations.cc
parent40911d7dec75541a400fe8f556d4c70a7f845fac (diff)
Split auto UID allocation from cgroups
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).
Diffstat (limited to 'src/libstore/parsed-derivations.cc')
-rw-r--r--src/libstore/parsed-derivations.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/parsed-derivations.cc b/src/libstore/parsed-derivations.cc
index f2288a04e..487dbcfbb 100644
--- a/src/libstore/parsed-derivations.cc
+++ b/src/libstore/parsed-derivations.cc
@@ -90,6 +90,7 @@ std::optional<Strings> ParsedDerivation::getStringsAttr(const std::string & name
StringSet ParsedDerivation::getRequiredSystemFeatures() const
{
+ // FIXME: cache this?
StringSet res;
for (auto & i : getStringsAttr("requiredSystemFeatures").value_or(Strings()))
res.insert(i);
@@ -125,6 +126,11 @@ bool ParsedDerivation::substitutesAllowed() const
return getBoolAttr("allowSubstitutes", true);
}
+bool ParsedDerivation::useUidRange() const
+{
+ return getRequiredSystemFeatures().count("uid-range");
+}
+
static std::regex shVarName("[A-Za-z_][A-Za-z0-9_]*");
std::optional<nlohmann::json> ParsedDerivation::prepareStructuredAttrs(Store & store, const StorePathSet & inputPaths)