Merge pull request 'fix select escaping' (#3857) from lassulus/test into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/3857
This commit is contained in:
lassulus
2025-06-06 10:58:14 +00:00

View File

@@ -755,19 +755,21 @@ class Flake:
in
derivation {{
name = "clan-flake-select";
result = builtins.toJSON [
{" ".join(
[
f"(selectLib.applySelectors (builtins.fromJSON ''{attr}'') flake)"
for attr in str_selectors
]
)}
];
passAsFile = [ "result" ];
system = "{config["system"]}";
builder = "/bin/sh";
args = [
"-c"
''
printf %s '${{builtins.toJSON [
{" ".join(
[
f"(selectLib.applySelectors (builtins.fromJSON ''{attr}'') flake)"
for attr in str_selectors
]
)}
]}}' > $out
read -r x < "$resultPath"; printf %s "$x" > $out
''
];
}}
@@ -784,9 +786,9 @@ class Flake:
if tmp_store:
build_output = tmp_store.joinpath(*build_output.parts[1:])
outputs = json.loads(build_output.read_text())
outputs = json.loads(build_output.read_bytes())
if len(outputs) != len(selectors):
msg = f"flake_prepare_cache: Expected {len(outputs)} outputs, got {len(outputs)}"
msg = f"flake_prepare_cache: Expected {len(outputs)} outputs, got {len(selectors)}"
raise ClanError(msg)
self.load_cache()
for i, selector in enumerate(selectors):