select: fix non escaped '

This commit is contained in:
lassulus
2025-06-04 14:57:58 +02:00
parent 39db9727d5
commit e96099d588

View File

@@ -755,19 +755,21 @@ class Flake:
in in
derivation {{ derivation {{
name = "clan-flake-select"; name = "clan-flake-select";
system = "{config["system"]}"; result = builtins.toJSON [
builder = "/bin/sh";
args = [
"-c"
''
printf %s '${{builtins.toJSON [
{" ".join( {" ".join(
[ [
f"(selectLib.applySelectors (builtins.fromJSON ''{attr}'') flake)" f"(selectLib.applySelectors (builtins.fromJSON ''{attr}'') flake)"
for attr in str_selectors for attr in str_selectors
] ]
)} )}
]}}' > $out ];
passAsFile = [ "result" ];
system = "{config["system"]}";
builder = "/bin/sh";
args = [
"-c"
''
read -r x < "$resultPath"; printf %s "$x" > $out
'' ''
]; ];
}} }}
@@ -784,7 +786,7 @@ class Flake:
if tmp_store: if tmp_store:
build_output = tmp_store.joinpath(*build_output.parts[1:]) 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): 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(outputs)}"
raise ClanError(msg) raise ClanError(msg)