formatting & test cuda support

This commit is contained in:
2026-05-03 12:03:57 -05:00
parent 4d552be249
commit f97d97a570
4 changed files with 70 additions and 61 deletions
+24 -24
View File
@@ -1,12 +1,15 @@
{ pkgs, nixpkgs-unstable, config, lib, ... }:
let
{
pkgs,
nixpkgs-unstable,
config,
lib,
...
}: let
service = "ollama";
cfg = config.homelab.${service};
sec = config.sops.secrets;
homelab = config.homelab;
in
{
in {
options.homelab.${service} = {
enable = lib.mkEnableOption "enables ${service}";
@@ -43,9 +46,8 @@ in
};
config = lib.mkIf cfg.enable {
# declare ${service} group
users.groups.${service} = { gid = lib.mkForce cfg.ids; };
users.groups.${service} = {gid = lib.mkForce cfg.ids;};
# declare ${service} user
users.users.${service} = {
@@ -69,13 +71,12 @@ in
host = "0.0.0.0";
port = cfg.port;
openFirewall = true;
acceleration = "vulkan";
acceleration = "cuda";
syncModels = true;
loadModels = [
"deepseek-r1:7b"
"deepseek-r1:14b"
];
};
# override umask to make permissions work out
@@ -84,7 +85,7 @@ in
};
# open firewall
networking.firewall.allowedTCPPorts = [ cfg.port ];
networking.firewall.allowedTCPPorts = [cfg.port];
services.caddy.virtualHosts."${cfg.url}" = {
extraConfig = ''
@@ -94,26 +95,25 @@ in
'';
};
# add to glance
homelab.glance.links.services = [{
title = service;
url = "https://git.${homelab.base_domain}";
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
icon = "di:${service}"; }];
# homelab.glance.links.services = [{
# title = service;
# url = "https://git.${homelab.base_domain}";
# error-url = "http://${homelab.host_ip}:${toString cfg.port}";
# check-url = "http://${homelab.host_ip}:${toString cfg.port}";
# icon = "di:${service}"; }];
# manage secrets with sops
# sops.secrets = {
# "${service}_database_password" = {
# owner = service;
# group = service;
# };
# };
# sops.secrets = {
# "${service}_database_password" = {
# owner = service;
# group = service;
# };
# };
# add to backups
homelab.backups.baks = {
${service} = { paths = [ cfg.data_dir ]; };
${service} = {paths = [cfg.data_dir];};
};
};
}
+23 -19
View File
@@ -1,12 +1,15 @@
{ pkgs, nixpkgs-unstable, config, lib, ... }:
let
{
pkgs,
nixpkgs-unstable,
config,
lib,
...
}: let
service = "open-webui";
cfg = config.homelab.${service};
sec = config.sops.secrets;
homelab = config.homelab;
in
{
in {
options.homelab.${service} = {
enable = lib.mkEnableOption "enables ${service}";
@@ -43,9 +46,8 @@ in
};
config = lib.mkIf cfg.enable {
# declare ${service} group
users.groups.${service} = { gid = lib.mkForce cfg.ids; };
users.groups.${service} = {gid = lib.mkForce cfg.ids;};
# declare ${service} user
users.users.${service} = {
@@ -77,7 +79,7 @@ in
};
# open firewall
networking.firewall.allowedTCPPorts = [ cfg.port ];
networking.firewall.allowedTCPPorts = [cfg.port];
services.caddy.virtualHosts."${cfg.url}" = {
extraConfig = ''
@@ -87,26 +89,28 @@ in
'';
};
# add to glance
homelab.glance.links.services = [{
homelab.glance.links.services = [
{
title = service;
url = "https://git.${homelab.base_domain}";
url = "https://ai.${homelab.base_domain}";
error-url = "http://${homelab.host_ip}:${toString cfg.port}";
check-url = "http://${homelab.host_ip}:${toString cfg.port}";
icon = "di:${service}"; }];
icon = "di:${service}";
}
];
# manage secrets with sops
# sops.secrets = {
# "${service}_database_password" = {
# owner = service;
# group = service;
# };
# };
# sops.secrets = {
# "${service}_database_password" = {
# owner = service;
# group = service;
# };
# };
# add to backups
homelab.backups.baks = {
${service} = { paths = [ cfg.data_dir ]; };
${service} = {paths = [cfg.data_dir];};
};
};
}
+8 -7
View File
@@ -1,10 +1,11 @@
{ pkgs, config, lib, ... }:
let
cfg = config.homelab;
in
{
pkgs,
config,
lib,
...
}: let
cfg = config.homelab;
in {
options.homelab = {
enable = lib.mkEnableOption "enable homelab services and configuration";
media_user = lib.mkOption {
@@ -41,10 +42,10 @@ in
# the order determines the order in glance :3
imports = [
./ai
./mediastack
./services
./system
./network
./ai
];
}
+9 -5
View File
@@ -28,8 +28,14 @@ in {
#interface = "enp89s0";
bind-interfaces = true;
address = [
"/snowbelle.lan/10.10.0.10"
"/.snowbelle.lan/10.10.0.10"
"/lumiose.lan/10.10.0.11"
"/.lumiose.lan/10.10.0.11"
"/bebe.lan/10.10.0.1"
];
server = [ # upstream dns
server = [
# upstream dns
"10.10.0.1"
];
};
@@ -37,13 +43,11 @@ in {
systemd.services.dnsmasq.serviceConfig = {
RestartSec = "5s";
StartLimitIntervalSec = 60;
StartLimitBurst = 10;
};
# open firewall
networking.firewall.allowedTCPPorts = [ cfg.port ];
networking.firewall.allowedUDPPorts = [ cfg.port ];
networking.firewall.allowedTCPPorts = [cfg.port];
networking.firewall.allowedUDPPorts = [cfg.port];
};
}