initial graphana
This commit is contained in:
@@ -71,6 +71,47 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
services.grafana = {
|
||||
enable = true;
|
||||
settings.server = {
|
||||
http_port = 2342;
|
||||
domain = hostname;
|
||||
serve_from_sub_path = true;
|
||||
http_addr = "";
|
||||
};
|
||||
dataDir = "/mnt/ssd/nix-app-data/grafana";
|
||||
};
|
||||
|
||||
|
||||
services.prometheus = {
|
||||
enable = true;
|
||||
port = 9001;
|
||||
exporters = {
|
||||
node = {
|
||||
enable = true;
|
||||
enabledCollectors = [ "diskstats" "systemd" ];
|
||||
port = 9002;
|
||||
};
|
||||
smartctl = {
|
||||
enable = true;
|
||||
group = "disk";
|
||||
devices = [ "/dev/sda" "/dev/sdb" "/dev/sdc" "/dev/sdd" "/dev/sde" "/dev/sdf" "/dev/sdg" "/dev/sdh" "/dev/sdi" "/dev/nvme0n1" "/dev/nvme1n1" ];
|
||||
};
|
||||
};
|
||||
|
||||
scrapeConfigs = [
|
||||
{
|
||||
job_name = hostname;
|
||||
static_configs = [{
|
||||
targets = [ "127.0.0.1:${toString config.services.prometheus.exporters.node.port}"
|
||||
"127.0.0.1:${toString config.services.prometheus.exporters.smartctl.port}"];
|
||||
}];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
|
||||
# Configure bootloader with lanzaboot and secureboot
|
||||
boot = {
|
||||
loader = {
|
||||
@@ -234,8 +275,8 @@ in
|
||||
enable = true;
|
||||
allowPing = true;
|
||||
extraCommands = ''iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns''; # TODO is this needed?
|
||||
allowedTCPPorts = [ 61208 ];
|
||||
allowedUDPPorts = [ 61208 ];
|
||||
allowedTCPPorts = [ 2342 61208 ];
|
||||
allowedUDPPorts = [ 2342 61208 ];
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
25
modules/hardware/gpu/amd/default.nix
Normal file
25
modules/hardware/gpu/amd/default.nix
Normal file
@@ -0,0 +1,25 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.hardware.gpu.amd;
|
||||
in {
|
||||
kernelParams = [ "amdgpu.ppfeaturemask=0xffffffff" ];
|
||||
|
||||
# Configure programs
|
||||
programs = { corectrl.enable };
|
||||
|
||||
# Configure environment
|
||||
environment = {
|
||||
# Force radv
|
||||
variables.AMD_VULKAN_ICD = "RADV";
|
||||
};
|
||||
# Hardware configs
|
||||
hardware = {
|
||||
# Enable OpenGL
|
||||
opengl = {
|
||||
enable = true;
|
||||
driSupport = true;
|
||||
driSupport32Bit = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
9
modules/hardware/gpu/amd/options.nix
Normal file
9
modules/hardware/gpu/amd/options.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.hardware.gpu.amd = {
|
||||
enable = mkEnableOption "amd hardware config";
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
42
modules/hardware/gpu/nvidia/default.nix
Normal file
42
modules/hardware/gpu/nvidia/default.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.hardware.gpu.nvidia;
|
||||
in {
|
||||
hardware = {
|
||||
# Nvidia
|
||||
nvidia = {
|
||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||
|
||||
# Modesetting is required.
|
||||
modesetting.enable = true;
|
||||
|
||||
# Nvidia power management. Experimental, and can cause sleep/suspend to fail.
|
||||
powerManagement.enable = false;
|
||||
|
||||
# Fine-grained power management. Turns off GPU when not in use.
|
||||
# Experimental and only works on modern Nvidia GPUs (Turing or newer).
|
||||
powerManagement.finegrained = false;
|
||||
|
||||
# Use the NVidia open source kernel module (not to be confused with the
|
||||
# independent third-party "nouveau" open source driver).
|
||||
# Support is limited to the Turing and later architectures. Full list of
|
||||
# supported GPUs is at:
|
||||
# https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus
|
||||
# Only available from driver 515.43.04+
|
||||
# Currently alpha-quality/buggy, so false is currently the recommended setting.
|
||||
open = false;
|
||||
|
||||
# Enable the Nvidia settings menu,
|
||||
# accessible via `nvidia-settings`.
|
||||
nvidiaSettings = true;
|
||||
};
|
||||
|
||||
# Enable OpenGL
|
||||
opengl = {
|
||||
enable = true;
|
||||
driSupport = true;
|
||||
driSupport32Bit = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
8
modules/hardware/gpu/nvidia/options.nix
Normal file
8
modules/hardware/gpu/nvidia/options.nix
Normal file
@@ -0,0 +1,8 @@
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.hardware.gpu.nvidia = {
|
||||
enable = mkEnableOption "nvidia hardware config";
|
||||
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user