Merge pull request #83307 from servalcatty/fix/v2ray-check

nixos/v2ray: check v2ray config during the build time

Changed files
+7 -1
nixos
modules
services
networking
+7 -1
nixos/modules/services/networking/v2ray.nix
···
cfg = config.services.v2ray;
configFile = if cfg.configFile != null
then cfg.configFile
-
else (pkgs.writeText "v2ray.json" (builtins.toJSON cfg.config));
+
else pkgs.writeTextFile {
+
name = "v2ray.json";
+
text = builtins.toJSON cfg.config;
+
checkPhase = ''
+
${pkgs.v2ray}/bin/v2ray -test -config $out
+
'';
+
};
in mkIf cfg.enable {
assertions = [