diff --git a/hosts/nas/configuration.nix b/hosts/nas/configuration.nix index ed2a982..f6947c3 100644 --- a/hosts/nas/configuration.nix +++ b/hosts/nas/configuration.nix @@ -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 ]; }; }; diff --git a/modules/hardware/gpu/amd/default.nix b/modules/hardware/gpu/amd/default.nix new file mode 100644 index 0000000..dd0ea00 --- /dev/null +++ b/modules/hardware/gpu/amd/default.nix @@ -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; + }; + }; +} diff --git a/modules/hardware/gpu/amd/options.nix b/modules/hardware/gpu/amd/options.nix new file mode 100644 index 0000000..6ab49ed --- /dev/null +++ b/modules/hardware/gpu/amd/options.nix @@ -0,0 +1,9 @@ +{ lib, ... }: +with lib; +{ + options.hardware.gpu.amd = { + enable = mkEnableOption "amd hardware config"; + + + }; +} diff --git a/modules/hardware/gpu/nvidia/default.nix b/modules/hardware/gpu/nvidia/default.nix new file mode 100644 index 0000000..8e31ded --- /dev/null +++ b/modules/hardware/gpu/nvidia/default.nix @@ -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; + }; + }; +} diff --git a/modules/hardware/gpu/nvidia/options.nix b/modules/hardware/gpu/nvidia/options.nix new file mode 100644 index 0000000..473cba8 --- /dev/null +++ b/modules/hardware/gpu/nvidia/options.nix @@ -0,0 +1,8 @@ +{ lib, ... }: +with lib; +{ + options.hardware.gpu.nvidia = { + enable = mkEnableOption "nvidia hardware config"; + + }; +}