trying a nixos container

This commit is contained in:
Chris Cochrun 2023-12-14 14:54:14 -06:00
parent 4e1f84e8ee
commit 5b3e377544
4 changed files with 84 additions and 1 deletions

View file

@ -66,7 +66,47 @@ with lib;
programs.fish.enable = true; programs.fish.enable = true;
virtualisation.docker.enable = true; virtualisation.docker.enable = true;
virtualisation.docker.enableNvidia = true;
services.openssh.enable = true; services.openssh.enable = true;
services.fstrim.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<Wrapped>[^ /]*) (?P<Args>.*)" ]; }
];
};
};
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}"
];
}];
}
];
};
};
} }

29
modules/localai.nix Normal file
View file

@ -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";
};
};
};
};
};
}

View file

@ -20,6 +20,7 @@
procs procs
btop btop
htop htop
smartmontools
#nvtop #nvtop
glxinfo glxinfo
vulkan-tools vulkan-tools

View file

@ -10,6 +10,7 @@
./hardware-configuration.nix ./hardware-configuration.nix
../../pkgs/base-packages.nix ../../pkgs/base-packages.nix
../../modules/base.nix ../../modules/base.nix
../../modules/localai.nix
]; ];
networking.hostName = "shen"; # Define your hostname. networking.hostName = "shen"; # Define your hostname.
@ -282,7 +283,7 @@
virtualHosts = { virtualHosts = {
"jitsi.tfcconnection.org".extraConfig = '' "jitsi.tfcconnection.org".extraConfig = ''
encode gzip encode gzip
reverse_proxy 127.0.0.1:8443 reverse_proxy 127.0.0.1:7843
''; '';
}; };
virtualHosts = { virtualHosts = {
@ -303,6 +304,18 @@
reverse_proxy 127.0.0.1:8008 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 = { virtualHosts = {
"lem.cochrun.xyz".extraConfig = '' "lem.cochrun.xyz".extraConfig = ''
reverse_proxy localhost:7080 reverse_proxy localhost:7080