Compare commits

...

2 commits

Author SHA1 Message Date
3bc12ecfa3 calcite: add keyd service to map keyboard 2023-12-19 14:25:22 +08:00
4e9bf3ebac init prometheus module 2023-12-18 10:46:01 +08:00
3 changed files with 64 additions and 0 deletions

View file

@ -71,6 +71,21 @@
layout = "us";
xkbVariant = "";
};
# Keyboard mapping on internal keyboard
services.keyd = {
enable = true;
keyboards = {
"internal" = {
ids = [ "0b05:1866" ];
settings = {
main = {
capslock = "overload(control, esc)";
leftcontrol = "capslock";
};
};
};
};
};
# Enable CUPS to print documents.
services.printing.enable = true;

View file

@ -3,5 +3,6 @@
imports = [
./restic.nix
./vaultwarden.nix
./prometheus.nix
];
}

View file

@ -0,0 +1,48 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.custom.prometheus;
in
{
options = {
custom.prometheus = {
enable = mkEnableOption "Prometheus instance";
exporters = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable Prometheus exporter on every supported services";
};
};
};
};
config = {
services.prometheus = mkIf cfg.enable {
enable = true;
port = 9091;
exporters = {
node = {
enable = true;
enabledCollectors = [ "systemd" ];
port = 9100;
};
};
scrapeConfigs = [
{ job_name = "prometheus";
static_configs = [
{ targets = [ "localhost:${toString config.services.prometheus.port}" ]; }
];
}
{ job_name = "node";
static_configs = [
{ targets = [ "localhost:${toString config.services.prometheus.exporters.node.port}" ]; }
];
}
];
};
};
}