mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 06:26:15 +02:00
Gate dynamic-derivations
with drv fromJSON
too
Don't want `nix derivation add` to be a way to sneak by experimental feature checks!
This commit is contained in:
parent
76baaeb341
commit
20decfd302
2 changed files with 11 additions and 1 deletions
|
@ -1005,6 +1005,8 @@ DerivationOutput DerivationOutput::fromJSON(
|
||||||
// remaining to parse, will be mutated by parsers
|
// remaining to parse, will be mutated by parsers
|
||||||
std::string_view s = hashAlgo;
|
std::string_view s = hashAlgo;
|
||||||
ContentAddressMethod method = ContentAddressMethod::parsePrefix(s);
|
ContentAddressMethod method = ContentAddressMethod::parsePrefix(s);
|
||||||
|
if (method == TextIngestionMethod {})
|
||||||
|
xpSettings.require(Xp::DynamicDerivations);
|
||||||
auto hashType = parseHashType(s);
|
auto hashType = parseHashType(s);
|
||||||
return { std::move(method), std::move(hashType) };
|
return { std::move(method), std::move(hashType) };
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,6 +26,14 @@ class CaDerivationTest : public DerivationTest
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class DynDerivationTest : public DerivationTest
|
||||||
|
{
|
||||||
|
void SetUp() override
|
||||||
|
{
|
||||||
|
mockXpSettings.set("experimental-features", "dynamic-derivations ca-derivations");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class ImpureDerivationTest : public DerivationTest
|
class ImpureDerivationTest : public DerivationTest
|
||||||
{
|
{
|
||||||
void SetUp() override
|
void SetUp() override
|
||||||
|
@ -83,7 +91,7 @@ TEST_JSON(DerivationTest, caFixed,
|
||||||
}),
|
}),
|
||||||
"drv-name", "output-name")
|
"drv-name", "output-name")
|
||||||
|
|
||||||
TEST_JSON(CaDerivationTest, caFixedText,
|
TEST_JSON(DynDerivationTest, caFixedText,
|
||||||
R"({
|
R"({
|
||||||
"hashAlgo": "text:sha256",
|
"hashAlgo": "text:sha256",
|
||||||
"hash": "894517c9163c896ec31a2adbd33c0681fd5f45b2c0ef08a64c92a03fb97f390f",
|
"hash": "894517c9163c896ec31a2adbd33c0681fd5f45b2c0ef08a64c92a03fb97f390f",
|
||||||
|
|
Loading…
Reference in a new issue