updates
This commit is contained in:
30
modules/apps/ollama/default.nix
Normal file
30
modules/apps/ollama/default.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
let cfg = config.nas-apps.ollama;
|
||||
in {
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
systemd.services.ollama-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}:11434 \
|
||||
-v '${cfg.configPath}:/root/.ollama' \
|
||||
${cfg.image}:latest
|
||||
'';
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
47
modules/apps/ollama/options.nix
Normal file
47
modules/apps/ollama/options.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
{ lib, ... }:
|
||||
with lib; {
|
||||
options.nas-apps.ollama = {
|
||||
enable = mkEnableOption "ollama docker service";
|
||||
|
||||
autoStart = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.str;
|
||||
default = "11434";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "ollama";
|
||||
};
|
||||
|
||||
image = mkOption {
|
||||
type = types.str;
|
||||
default = "ollama/ollama";
|
||||
};
|
||||
|
||||
configPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/mnt/ssd/nix-app-data/ollama";
|
||||
};
|
||||
|
||||
puid = mkOption {
|
||||
type = types.str;
|
||||
default = "911";
|
||||
};
|
||||
|
||||
pgid = mkOption {
|
||||
type = types.str;
|
||||
default = "1000";
|
||||
};
|
||||
|
||||
timeZone = mkOption {
|
||||
type = types.str;
|
||||
default = "America/Chicago";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
33
modules/apps/open-webui/default.nix
Normal file
33
modules/apps/open-webui/default.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
with lib;
|
||||
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" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
# --add-host=host.docker.internal:host-gateway \
|
||||
# -e 'OLLAMA_BASE_URL'='http://10.0.1.18:11434' \
|
||||
47
modules/apps/open-webui/options.nix
Normal file
47
modules/apps/open-webui/options.nix
Normal file
@@ -0,0 +1,47 @@
|
||||
{ lib, ... }:
|
||||
with lib; {
|
||||
options.nas-apps.open-webui = {
|
||||
enable = mkEnableOption "open-webui docker service";
|
||||
|
||||
autoStart = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.str;
|
||||
default = "8888";
|
||||
};
|
||||
|
||||
name = mkOption {
|
||||
type = types.str;
|
||||
default = "open-webui";
|
||||
};
|
||||
|
||||
image = mkOption {
|
||||
type = types.str;
|
||||
default = "ghcr.io/open-webui/open-webui:ollama";
|
||||
};
|
||||
|
||||
configPath = mkOption {
|
||||
type = types.str;
|
||||
default = "/mnt/ssd/nix-app-data/open-webui";
|
||||
};
|
||||
|
||||
puid = mkOption {
|
||||
type = types.str;
|
||||
default = "911";
|
||||
};
|
||||
|
||||
pgid = mkOption {
|
||||
type = types.str;
|
||||
default = "1000";
|
||||
};
|
||||
|
||||
timeZone = mkOption {
|
||||
type = types.str;
|
||||
default = "America/Chicago";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
@@ -65,7 +65,7 @@ with lib; {
|
||||
|
||||
subdomains = mkOption {
|
||||
type = types.str;
|
||||
default = "jellyfin,hass,cloud,office,jellyseerr";
|
||||
default = "jellyfin,jellyseerr,cloud,office,chat,hass";
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@
|
||||
./apps/jellyseerr
|
||||
./apps/mariadb
|
||||
./apps/nextcloud
|
||||
./apps/ollama
|
||||
./apps/open-webui
|
||||
./apps/orca-slicer
|
||||
./apps/radarr
|
||||
./apps/sabnzbd
|
||||
|
||||
Reference in New Issue
Block a user