diff --git a/modules/base.nix b/modules/base.nix index a2d97c6..b7a1162 100644 --- a/modules/base.nix +++ b/modules/base.nix @@ -66,7 +66,47 @@ with lib; programs.fish.enable = true; virtualisation.docker.enable = true; + virtualisation.docker.enableNvidia = true; services.openssh.enable = true; services.fstrim.enable = true; + services = { + grafana = { + enable = true; + settings.server = { + http_port = 4358; + http_addr = "127.0.0.1"; + }; + }; + prometheus = { + enable = true; + port = 4359; + exporters = { + node = { + enable = true; + enabledCollectors = [ "systemd" "processes" "drm" ]; + port = 9002; + }; + smartctl.enable = true; + process = { + enable = true; + settings.process_names = [ + { name = "{{.Matches.Wrapped}} {{ .Matches.Args }}"; cmdline = [ "^/nix/store[^ ]*/(?P[^ /]*) (?P.*)" ]; } + ]; + }; + }; + scrapeConfigs = [ + { + job_name = "shen"; + 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}" + ]; + }]; + } + ]; + }; + }; + } diff --git a/modules/localai.nix b/modules/localai.nix new file mode 100644 index 0000000..e120f3e --- /dev/null +++ b/modules/localai.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: + +with lib; +{ + virtualisation = { + podman = { + enable = true; + enableNvidia = true; + }; + oci-containers = { + # backend = "podman"; + containers = { + localai = { + image = [ "quay.io/go-skynet/local-ai:v2.0.0-cublas-cuda11-ffmpeg" ]; + autoStart = true; + ports = [ "7890:8080" ]; + volumes = [ "/home/chris/localai/models:/models" ]; + environment = { + THREADS = "2"; + MODELS_PATH = "/models"; + DEBUG = true; + REBUILD = true; + BUILD_TYPE = "cublas"; + }; + }; + }; + }; + }; +} diff --git a/pkgs/base-packages.nix b/pkgs/base-packages.nix index 2901c7c..5bf8f0a 100644 --- a/pkgs/base-packages.nix +++ b/pkgs/base-packages.nix @@ -20,6 +20,7 @@ procs btop htop + smartmontools #nvtop glxinfo vulkan-tools diff --git a/system/shen/configuration.nix b/system/shen/configuration.nix index d6f59d5..0ff1511 100644 --- a/system/shen/configuration.nix +++ b/system/shen/configuration.nix @@ -10,6 +10,7 @@ ./hardware-configuration.nix ../../pkgs/base-packages.nix ../../modules/base.nix + ../../modules/localai.nix ]; networking.hostName = "shen"; # Define your hostname. @@ -282,7 +283,7 @@ virtualHosts = { "jitsi.tfcconnection.org".extraConfig = '' encode gzip - reverse_proxy 127.0.0.1:8443 + reverse_proxy 127.0.0.1:7843 ''; }; virtualHosts = { @@ -303,6 +304,18 @@ reverse_proxy 127.0.0.1:8008 ''; }; + virtualHosts = { + "api.tfcconnection.org".extraConfig = '' + encode gzip + reverse_proxy 127.0.0.1:4242 + ''; + }; + virtualHosts = { + "graf.tfcconnection.org".extraConfig = '' + encode gzip + reverse_proxy 127.0.0.1:4358 + ''; + }; virtualHosts = { "lem.cochrun.xyz".extraConfig = '' reverse_proxy localhost:7080