chore: nf-fmt-nix

This commit is contained in:
arcnmx 2024-05-17 18:58:32 -07:00
parent 1d806cd552
commit 3099654a97
8 changed files with 297 additions and 257 deletions

View file

@ -1,9 +1,19 @@
{ pkgs, config, lib, access, gensokyo-zone, ... }: let
{
pkgs,
config,
lib,
access,
gensokyo-zone,
...
}: let
inherit (gensokyo-zone) systems;
inherit (lib.attrsets) filterAttrs mapAttrsToList attrNames;
promtailSystems = filterAttrs (_: system:
promtailSystems =
filterAttrs (
_: system:
system.config.exporters.promtail.enable or false
) systems;
)
systems;
inherit (builtins) toJSON;
inherit (lib.options) mkOption;
inherit (lib.types) port;
@ -27,7 +37,7 @@ in {
configFile = pkgs.writeTextFile {
name = "config.yaml";
executable = false;
text = (toJSON {
text = toJSON {
server = {
http_listen_port = cfg.settings.httpListenPort;
grpc_listen_port = cfg.settings.grpcListenPort;
@ -35,10 +45,13 @@ in {
positions = {
filename = "/tmp/positions.yaml";
};
clients = mapAttrsToList (system: systemConfig: {
clients =
mapAttrsToList (system: systemConfig: {
url = "${access.getAddressFor system.config.name "local"}:${system.config.exporters.promtail.port}";
}) promtailSystems;
scrape_configs = mapAttrsToList (system: systemConfig: {
})
promtailSystems;
scrape_configs =
mapAttrsToList (system: systemConfig: {
job_name = "${system.config.name}-journal";
journal = {
max_age = "${24 * 7}h";
@ -53,8 +66,9 @@ in {
target_label = "unit";
}
];
}) promtailSystems;
});
})
promtailSystems;
};
};
};
};

View file

@ -1,20 +1,30 @@
{ access, lib, gensokyo-zone, ... }: let
{
access,
lib,
gensokyo-zone,
...
}: let
inherit (gensokyo-zone) systems;
inherit (lib.attrsets) filterAttrs mapAttrsToList attrNames;
nodeExporterSystems = filterAttrs (_: system:
nodeExporterSystems =
filterAttrs (
_: system:
system.config.exporters.prometheus-exporters-node.enable or false
) systems;
)
systems;
in {
services.prometheus = {
#enable = true;
port = 9090;
scrapeConfigs = mapAttrsToList (system: systemConfig: {
scrapeConfigs =
mapAttrsToList (system: systemConfig: {
job_name = "${system.config.name}-node-exporter";
static_configs = {
targets = [
"${access.getAddressFor system.config.name "local"}:${system.config.exporters.prometheus-exporters-node.port}"
];
};
}) nodeExporterSystems;
})
nodeExporterSystems;
};
}

View file

@ -1,4 +1,8 @@
{ config, lib, ... }: let
{
config,
lib,
...
}: let
inherit (lib.modules) mkIf mkMerge;
in {
config = {

View file

@ -1,4 +1,8 @@
{ config, lib, ... }: let
{
config,
lib,
...
}: let
inherit (builtins) toJSON;
inherit (lib.options) mkOption;
inherit (lib.types) port;

View file

@ -1,4 +1,8 @@
{lib, gensokyo-zone, ...}: let
{
lib,
gensokyo-zone,
...
}: let
inherit (gensokyo-zone.lib) mapAlmostOptionDefaults mkAlmostOptionDefault;
inherit (lib.modules) mkIf;
in {

View file

@ -1,11 +1,15 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/nixos.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"];
@ -13,13 +17,13 @@
boot.kernelModules = ["kvm-intel"];
boot.extraModulePackages = [];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/3331f9a0-6b86-411c-8574-63de28046cf2";
fileSystems."/" = {
device = "/dev/disk/by-uuid/3331f9a0-6b86-411c-8574-63de28046cf2";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/8DC2-0DAE";
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/8DC2-0DAE";
fsType = "vfat";
options = ["fmask=0022" "dmask=0022"];
};