formatting
This commit is contained in:
@@ -1,33 +1,34 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
{
|
||||
lib,
|
||||
pkgs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
with lib;
|
||||
let cfg = config.nas-apps.open-webui;
|
||||
in {
|
||||
let
|
||||
cfg = config.nas-apps.open-webui;
|
||||
in
|
||||
{
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
systemd.services.open-webui-docker = {
|
||||
path = [ pkgs.bash pkgs.docker ];
|
||||
script = ''
|
||||
set -e
|
||||
exec docker run \
|
||||
--rm \
|
||||
--gpus all \
|
||||
--runtime=nvidia \
|
||||
--name=${cfg.name} \
|
||||
-e PUID=${cfg.puid} \
|
||||
-e PGID=${cfg.pgid} \
|
||||
-e TZ=${cfg.timeZone} \
|
||||
-e 'NVIDIA_DRIVER_CAPABILITIES'='all' \
|
||||
-e 'NVIDIA_VISIBLE_DEVICES'='all' \
|
||||
-p ${cfg.port}:8080 \
|
||||
-v '${cfg.configPath}:/app/backend/data' \
|
||||
-v '/mnt/ssd/nix-app-data/ollama:/root/.ollama' \
|
||||
${cfg.image}
|
||||
'';
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
virtualisation.oci-containers.containers.${cfg.name} = {
|
||||
autoStart = true;
|
||||
image = cfg.image;
|
||||
extraOptions = [ "--device=nvidia.com/gpu=0" ];
|
||||
volumes = [
|
||||
"${cfg.configPath}:/app/backend/data"
|
||||
"${cfg.ollamaPath}:/root/.ollama"
|
||||
];
|
||||
ports = [ "${cfg.port}:8080" ];
|
||||
environment = {
|
||||
NVIDIA_VISIBLE_DEVICES = "all";
|
||||
NVIDIA_DRIVER_CAPABILITIES = "all";
|
||||
PUID = cfg.puid;
|
||||
PGID = cfg.pgid;
|
||||
TZ = cfg.timeZone;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
# --add-host=host.docker.internal:host-gateway \
|
||||
# -e 'OLLAMA_BASE_URL'='http://10.0.1.18:11434' \
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{ lib, ... }:
|
||||
with lib; {
|
||||
with lib;
|
||||
{
|
||||
options.nas-apps.open-webui = {
|
||||
enable = mkEnableOption "open-webui docker service";
|
||||
|
||||
@@ -42,6 +43,5 @@ with lib; {
|
||||
type = types.str;
|
||||
default = "America/Chicago";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user