modules/monitoring: add loki and promtail

This commit is contained in:
xinyangli 2024-12-02 14:44:26 +08:00
parent 92db38383e
commit 2ec4b611a8
Signed by: xin
SSH key fingerprint: SHA256:UU5pRTl7NiLFJbWJZa+snLylZSXIz5rgHmwjzv8v4oE
20 changed files with 406 additions and 82 deletions

View file

@ -0,0 +1,38 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib)
mkIf
mkOption
types
mkDefault
;
cfg = config.inMainland;
in
{
options.inMainland = mkOption {
type = types.bool;
default = config.time.timeZone == "Asia/Shanghai";
};
config = mkIf cfg.enable {
nix.conf.extra-substituters = [
"https://mirrors.cernet.edu.cn/nix-channels/store?priority=20"
];
networking.timeServers = [
"cn.ntp.org.cn"
"ntp.ntsc.ac.cn"
];
services.dae = {
enable = mkDefault true;
};
};
}

View file

@ -21,7 +21,6 @@ in
default = true;
type = types.bool;
};
enableMirrors = mkEnableOption "cache.nixos.org mirrors in Mainland China";
signing = {
enable = mkEnableOption "Sign locally-built paths";
keyFile = mkOption {
@ -55,10 +54,6 @@ in
"https://cache.garnix.io"
];
extra-substituters = mkIf cfg.enableMirrors [
"https://mirrors.cernet.edu.cn/nix-channels/store?priority=20"
];
trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="

View file

@ -9,8 +9,6 @@ let
mkIf
mkEnableOption
mkOption
mkDefault
types
;
cfg = config.commonSettings.proxyServer;
@ -26,6 +24,9 @@ let
mkSingConfig =
{ uuid, password, ... }:
{
log = {
level = "warn";
};
inbounds =
[
{