diff --git a/nixos/modules/services/networking/knot-resolver.nix b/nixos/modules/services/networking/knot-resolver.nix index 96b39745a02f..9574859293d1 100644 --- a/nixos/modules/services/networking/knot-resolver.nix +++ b/nixos/modules/services/networking/knot-resolver.nix @@ -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 = [