Merge pull request #314767 from Guanran928/mihomo

nixos/mihomo: add assertion for configFile
This commit is contained in:
Sandro 2024-07-02 20:27:36 +02:00 committed by GitHub
commit 230c213fae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,10 +2,11 @@
# cfg.configFile contains secrets such as proxy servers' credential!
# we dont want plaintext secrets in world-readable `/nix/store`.
{ lib
, config
, pkgs
, ...
{
lib,
config,
pkgs,
...
}:
let
cfg = config.services.mihomo;
@ -17,7 +18,6 @@ in
package = lib.mkPackageOption pkgs "mihomo" { };
configFile = lib.mkOption {
default = null;
type = lib.types.nullOr lib.types.path;
description = "Configuration file to use.";
};
@ -67,7 +67,7 @@ in
ExecStart = lib.concatStringsSep " " [
(lib.getExe cfg.package)
"-d /var/lib/private/mihomo"
(lib.optionalString (cfg.configFile != null) "-f \${CREDENTIALS_DIRECTORY}/config.yaml")
"-f \${CREDENTIALS_DIRECTORY}/config.yaml"
(lib.optionalString (cfg.webui != null) "-ext-ui ${cfg.webui}")
(lib.optionalString (cfg.extraOpts != null) cfg.extraOpts)
];