From 4e9bf3ebacd76541a69595d3f9792d8981760b53 Mon Sep 17 00:00:00 2001 From: xinyangli Date: Mon, 18 Dec 2023 10:46:01 +0800 Subject: [PATCH 1/2] init prometheus module --- modules/nixos/default.nix | 1 + modules/nixos/prometheus.nix | 48 ++++++++++++++++++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 modules/nixos/prometheus.nix diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 1b91ad5..e89ad69 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -3,5 +3,6 @@ imports = [ ./restic.nix ./vaultwarden.nix + ./prometheus.nix ]; } \ No newline at end of file diff --git a/modules/nixos/prometheus.nix b/modules/nixos/prometheus.nix new file mode 100644 index 0000000..ac0a976 --- /dev/null +++ b/modules/nixos/prometheus.nix @@ -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}" ]; } + ]; + } + ]; + }; + }; +} \ No newline at end of file From 3bc12ecfa3b01b96da97aa12f2e36e415d0a5641 Mon Sep 17 00:00:00 2001 From: xinyangli Date: Tue, 19 Dec 2023 14:25:22 +0800 Subject: [PATCH 2/2] calcite: add keyd service to map keyboard --- machines/calcite/configuration.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/machines/calcite/configuration.nix b/machines/calcite/configuration.nix index d6b36dd..43251e2 100644 --- a/machines/calcite/configuration.nix +++ b/machines/calcite/configuration.nix @@ -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;