nixos/knot-resolver: skip config validation when cross-compiling (#474509)

This commit is contained in:
Jared Baur
2025-12-27 15:08:41 +00:00
committed by GitHub
@@ -7,17 +7,28 @@
let
cfg = config.services.knot-resolver;
# pkgs.writers.yaml_1_1.generate with additional kresctl validate
configFile =
pkgs.runCommandLocal "knot-resolver.yaml"
configFile = pkgs.callPackage (
{
runCommandLocal,
remarshal_0_17,
stdenv,
}:
runCommandLocal "knot-resolver.yaml"
{
nativeBuildInputs = [ pkgs.remarshal_0_17 ];
nativeBuildInputs = [ remarshal_0_17 ];
value = builtins.toJSON cfg.settings;
passAsFile = [ "value" ];
}
''
json2yaml "$valuePath" "$out"
${cfg.managerPackage}/bin/kresctl validate "$out"
'';
${
# We skip validation if the build platform cannot execute # the binary targeting the host platform.
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
${cfg.managerPackage}/bin/kresctl validate "$out"
''
}
''
) { };
in
{
meta.maintainers = [