forked from lix-project/lix
Merge pull request #4905 from NixOS/ca-derivations-machine-feature
Add a ca-derivations required machine feature
This commit is contained in:
commit
d9a43d3137
|
@ -91,6 +91,8 @@ StringSet ParsedDerivation::getRequiredSystemFeatures() const
|
||||||
StringSet res;
|
StringSet res;
|
||||||
for (auto & i : getStringsAttr("requiredSystemFeatures").value_or(Strings()))
|
for (auto & i : getStringsAttr("requiredSystemFeatures").value_or(Strings()))
|
||||||
res.insert(i);
|
res.insert(i);
|
||||||
|
if (!derivationHasKnownOutputPaths(drv.type()))
|
||||||
|
res.insert("ca-derivations");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -337,6 +337,13 @@ ValidPathInfo Store::addToStoreSlow(std::string_view name, const Path & srcPath,
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringSet StoreConfig::getDefaultSystemFeatures()
|
||||||
|
{
|
||||||
|
auto res = settings.systemFeatures.get();
|
||||||
|
if (settings.isExperimentalFeatureEnabled("ca-derivations"))
|
||||||
|
res.insert("ca-derivations");
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
Store::Store(const Params & params)
|
Store::Store(const Params & params)
|
||||||
: StoreConfig(params)
|
: StoreConfig(params)
|
||||||
|
|
|
@ -180,6 +180,8 @@ struct StoreConfig : public Config
|
||||||
|
|
||||||
StoreConfig() = delete;
|
StoreConfig() = delete;
|
||||||
|
|
||||||
|
StringSet getDefaultSystemFeatures();
|
||||||
|
|
||||||
virtual ~StoreConfig() { }
|
virtual ~StoreConfig() { }
|
||||||
|
|
||||||
virtual const std::string name() = 0;
|
virtual const std::string name() = 0;
|
||||||
|
@ -196,7 +198,7 @@ struct StoreConfig : public Config
|
||||||
|
|
||||||
Setting<bool> wantMassQuery{this, false, "want-mass-query", "whether this substituter can be queried efficiently for path validity"};
|
Setting<bool> wantMassQuery{this, false, "want-mass-query", "whether this substituter can be queried efficiently for path validity"};
|
||||||
|
|
||||||
Setting<StringSet> systemFeatures{this, settings.systemFeatures,
|
Setting<StringSet> systemFeatures{this, getDefaultSystemFeatures(),
|
||||||
"system-features",
|
"system-features",
|
||||||
"Optional features that the system this store builds on implements (like \"kvm\")."};
|
"Optional features that the system this store builds on implements (like \"kvm\")."};
|
||||||
|
|
||||||
|
|
|
@ -4,4 +4,6 @@ file=build-hook-ca-floating.nix
|
||||||
|
|
||||||
sed -i 's/experimental-features .*/& ca-derivations/' "$NIX_CONF_DIR"/nix.conf
|
sed -i 's/experimental-features .*/& ca-derivations/' "$NIX_CONF_DIR"/nix.conf
|
||||||
|
|
||||||
|
CONTENT_ADDRESSED=true
|
||||||
|
|
||||||
source build-remote.sh
|
source build-remote.sh
|
||||||
|
|
|
@ -6,12 +6,17 @@ unset NIX_STATE_DIR
|
||||||
|
|
||||||
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
|
function join_by { local d=$1; shift; echo -n "$1"; shift; printf "%s" "${@/#/$d}"; }
|
||||||
|
|
||||||
|
EXTRA_SYSTEM_FEATURES=()
|
||||||
|
if [[ -n "$CONTENT_ADDRESSED" ]]; then
|
||||||
|
EXTRA_SYSTEM_FEATURES=("ca-derivations")
|
||||||
|
fi
|
||||||
|
|
||||||
builders=(
|
builders=(
|
||||||
# system-features will automatically be added to the outer URL, but not inner
|
# system-features will automatically be added to the outer URL, but not inner
|
||||||
# remote-store URL.
|
# remote-store URL.
|
||||||
"ssh://localhost?remote-store=$TEST_ROOT/machine1?system-features=foo - - 1 1 foo"
|
"ssh://localhost?remote-store=$TEST_ROOT/machine1?system-features=$(join_by "%20" foo ${EXTRA_SYSTEM_FEATURES[@]}) - - 1 1 $(join_by "," foo ${EXTRA_SYSTEM_FEATURES[@]})"
|
||||||
"$TEST_ROOT/machine2 - - 1 1 bar"
|
"$TEST_ROOT/machine2 - - 1 1 $(join_by "," bar ${EXTRA_SYSTEM_FEATURES[@]})"
|
||||||
"ssh-ng://localhost?remote-store=$TEST_ROOT/machine3?system-features=baz - - 1 1 baz"
|
"ssh-ng://localhost?remote-store=$TEST_ROOT/machine3?system-features=$(join_by "%20" baz ${EXTRA_SYSTEM_FEATURES[@]}) - - 1 1 $(join_by "," baz ${EXTRA_SYSTEM_FEATURES[@]})"
|
||||||
)
|
)
|
||||||
|
|
||||||
chmod -R +w $TEST_ROOT/machine* || true
|
chmod -R +w $TEST_ROOT/machine* || true
|
||||||
|
|
Loading…
Reference in a new issue