From 5ec7ee21e036f7bc1cbdec714271c619cb3fdb3d Mon Sep 17 00:00:00 2001 From: seth Date: Sun, 27 Oct 2024 20:12:19 -0400 Subject: modules: restructure (#487) * seth: remove unused pkgs * modules: restructure from archetypes back to profiles make less actual modules for everything use lib.mkDefault like it's supposed to move mixins out of server * nixos/resolved: use modern options --- modules/nixos/mixins/promtail.nix | 48 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 modules/nixos/mixins/promtail.nix (limited to 'modules/nixos/mixins/promtail.nix') diff --git a/modules/nixos/mixins/promtail.nix b/modules/nixos/mixins/promtail.nix new file mode 100644 index 0000000..022c271 --- /dev/null +++ b/modules/nixos/mixins/promtail.nix @@ -0,0 +1,48 @@ +{ config, lib, ... }: +let + cfg = config.mixins.promtail; + inherit (lib) types; +in +{ + options.mixins.promtail = { + enable = lib.mkEnableOption "Promtail mixin"; + + clients = lib.mkOption { + type = types.listOf types.attrs; + default = [ { } ]; + defaultText = lib.literalExpression "[ { } ]"; + description = "Clients for promtail"; + }; + }; + + config = lib.mkIf cfg.enable { + services.promtail = { + enable = true; + configuration = { + inherit (cfg) clients; + server.disable = true; + + scrape_configs = [ + { + job_name = "journal"; + + journal = { + max_age = "12h"; + labels = { + job = "systemd-journal"; + host = "${config.networking.hostName}"; + }; + }; + + relabel_configs = [ + { + source_labels = [ "__journal__systemd_unit" ]; + target_label = "unit"; + } + ]; + } + ]; + }; + }; + }; +} -- cgit v1.2.3