nixos/v2ray: check v2ray config during the build time

This commit is contained in:
Serval 2020-03-25 01:51:56 +08:00
parent d96bd3394b
commit 75afd2fc34
No known key found for this signature in database
GPG Key ID: 4A2AAAA382F8294C

View File

@ -58,7 +58,13 @@ with lib;
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 = [