reorganize
This commit is contained in:
1
system/virtualization/docker/authentik/default.nix
Normal file
1
system/virtualization/docker/authentik/default.nix
Normal file
@@ -0,0 +1 @@
|
||||
{ ... }: {}
|
||||
48
system/virtualization/docker/default.nix
Normal file
48
system/virtualization/docker/default.nix
Normal file
@@ -0,0 +1,48 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
|
||||
options.sysconfig.docker = {
|
||||
enable = with lib; mkOption {
|
||||
type = with types; bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
nvidia = with lib; mkOption {
|
||||
type = with types; bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
|
||||
imports = let
|
||||
dir = builtins.readDir ./.;
|
||||
in builtins.map (x: ./${x}) (builtins.filter
|
||||
(file: (dir.${file} == "directory"))
|
||||
(builtins.attrNames dir)
|
||||
);
|
||||
|
||||
config = lib.mkIf config.sysconfig.docker.enable {
|
||||
|
||||
networking.nat.internalInterfaces = [ "docker0" "docker-main" ];
|
||||
|
||||
virtualisation = {
|
||||
docker = {
|
||||
enable = true;
|
||||
storageDriver = "btrfs";
|
||||
};
|
||||
|
||||
oci-containers = {
|
||||
backend = "docker";
|
||||
};
|
||||
};
|
||||
|
||||
hardware.nvidia-container-toolkit.enable = config.sysconfig.docker.nvidia;
|
||||
|
||||
system.activationScripts.setupDockerNet = ''
|
||||
${pkgs.docker}/bin/docker network ls | grep docker-main ||
|
||||
${pkgs.docker}/bin/docker network create -d bridge docker-main \
|
||||
--attachable --subnet 192.168.101.0/24 --ip-range 192.168.101.0/24 \
|
||||
--gateway 192.168.101.1 \
|
||||
-o "com.docker.network.bridge.name"="docker-main" \
|
||||
-o "com.docker.network.bridge.trusted_host_interfaces"="wt0:ve-netbird:ve-traefik"
|
||||
'';
|
||||
};
|
||||
}
|
||||
63
system/virtualization/docker/ollama/default.nix
Normal file
63
system/virtualization/docker/ollama/default.nix
Normal file
@@ -0,0 +1,63 @@
|
||||
{ config, lib, pkgs, ... }: {
|
||||
|
||||
options.sysconfig.docker.ollama.enable = with lib; mkOption {
|
||||
type = with types; bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.sysconfig.docker.ollama.enable && config.sysconfig.docker.enable) {
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
ollama
|
||||
];
|
||||
|
||||
networking.firewall.interfaces = {
|
||||
"ve-traefik" = {
|
||||
allowedTCPPorts = [ 11434 ];
|
||||
};
|
||||
|
||||
"ve-openwebui" = {
|
||||
allowedTCPPorts = [ 11434 ];
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers.ollama = {
|
||||
image = "ollama/ollama:latest";
|
||||
|
||||
# unstable, waiting for 26.05
|
||||
#pull = "newer";
|
||||
|
||||
hostname = "ollama.esotericbytes.com";
|
||||
|
||||
networks = [
|
||||
"docker-main"
|
||||
];
|
||||
|
||||
ports = [
|
||||
"11434:11434"
|
||||
];
|
||||
|
||||
volumes = [
|
||||
"vol_ollama:/root/.ollama"
|
||||
];
|
||||
|
||||
labels = {
|
||||
"traefik.http.routers.ollama.entrypoints" = "localsecure";
|
||||
"traefik.http.routers.ollama.rule" = "Host(`ollama.esotericbytes.com`)";
|
||||
"traefik.http.routers.ollama.service" = "ollama";
|
||||
"traefik.http.routers.ollama.tls.certResolver" = "cloudflare";
|
||||
|
||||
"traefik.http.services.ollama.loadbalancer.server.url" = "http://192.168.100.10:11434";
|
||||
};
|
||||
|
||||
extraOptions = lib.mkIf config.sysconfig.docker.nvidia [
|
||||
"--device=nvidia.com/gpu=all"
|
||||
"--ip=192.168.101.4"
|
||||
];
|
||||
|
||||
environment = {
|
||||
OLLAMA_CONTEXT_LENGTH = lib.mkDefault "32000";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
70
system/virtualization/docker/pihole/default.nix
Normal file
70
system/virtualization/docker/pihole/default.nix
Normal file
@@ -0,0 +1,70 @@
|
||||
{ config, lib, ... }: {
|
||||
|
||||
options.sysconfig.docker.pihole.enable = with lib; mkOption {
|
||||
type = with types; bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.sysconfig.docker.pihole.enable && config.sysconfig.docker.enable) {
|
||||
|
||||
environment.etc."resolv.conf" = {
|
||||
enable = true;
|
||||
text = ''
|
||||
nameserver 127.0.0.1
|
||||
nameserver 1.1.1.1
|
||||
nameserver 1.0.0.1
|
||||
options edns0
|
||||
'';
|
||||
|
||||
user = "root";
|
||||
mode = "0664";
|
||||
};
|
||||
|
||||
networking.firewall.interfaces = {
|
||||
"ve-traefik" = {
|
||||
allowedTCPPorts = [ 9001 ];
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers.pihole = {
|
||||
image = "pihole/pihole:latest";
|
||||
|
||||
# unstable, waiting for 26.05
|
||||
#pull = "newer";
|
||||
|
||||
hostname = "pihole.esotericbytes.com";
|
||||
|
||||
networks = [
|
||||
"docker-main"
|
||||
];
|
||||
|
||||
labels = {
|
||||
"traefik.http.routers.pihole.entrypoints" = "localsecure";
|
||||
"traefik.http.routers.pihole.rule" = "Host(`pihole.esotericbytes.com`)";
|
||||
"traefik.http.routers.pihole.service" = "pihole";
|
||||
"traefik.http.routers.pihole.tls.certResolver" = "cloudflare";
|
||||
|
||||
"traefik.http.services.pihole.loadbalancer.server.url" = "http://192.168.100.10:9001";
|
||||
};
|
||||
|
||||
extraOptions = lib.mkIf config.sysconfig.docker.nvidia [
|
||||
"--ip=192.168.101.3"
|
||||
];
|
||||
|
||||
ports = [
|
||||
"9001:80"
|
||||
"127.0.0.1:53:53/tcp"
|
||||
"127.0.0.1:53:53/udp"
|
||||
];
|
||||
|
||||
volumes = [
|
||||
"vol_pihole:/etc/pihole"
|
||||
];
|
||||
|
||||
environment = {
|
||||
FTLCONF_webserver_api_password = "7567";
|
||||
FTLCONF_dns_listeningMode = "ALL";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
52
system/virtualization/docker/portainer/default.nix
Normal file
52
system/virtualization/docker/portainer/default.nix
Normal file
@@ -0,0 +1,52 @@
|
||||
{ config, lib, ... }: {
|
||||
|
||||
options.sysconfig.docker.portainer.enable = with lib; mkOption {
|
||||
type = with types; bool;
|
||||
default = true;
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.sysconfig.docker.portainer.enable && config.sysconfig.docker.enable) {
|
||||
|
||||
networking.firewall.interfaces = {
|
||||
"ve-traefik" = {
|
||||
allowedTCPPorts = [ 9000 ];
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers.portainer = {
|
||||
image = "portainer/portainer-ce:latest";
|
||||
|
||||
# unstable, waiting for 26.05
|
||||
#pull = "newer";
|
||||
|
||||
hostname = "portainer.esotericbytes.com";
|
||||
|
||||
networks = [
|
||||
"docker-main"
|
||||
];
|
||||
|
||||
labels = {
|
||||
"traefik.http.routers.portainer.entrypoints" = "localsecure";
|
||||
"traefik.http.routers.portainer.rule" = "Host(`prtnr.esotericbytes.com`)";
|
||||
"traefik.http.routers.portainer.service" = "portainer";
|
||||
"traefik.http.routers.portainer.tls.certResolver" = "cloudflare";
|
||||
|
||||
"traefik.http.services.portainer.loadbalancer.server.url" = "http://192.168.100.10:9000";
|
||||
};
|
||||
|
||||
extraOptions = lib.mkIf config.sysconfig.docker.nvidia [
|
||||
"--ip=192.168.101.2"
|
||||
];
|
||||
|
||||
ports = [
|
||||
"127.0.0.1:8000:8000"
|
||||
"9000:9000"
|
||||
];
|
||||
|
||||
volumes = [
|
||||
"vol_portainer:/data"
|
||||
"/run/docker.sock:/var/run/docker.sock"
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
55
system/virtualization/docker/searxng/default.nix
Normal file
55
system/virtualization/docker/searxng/default.nix
Normal file
@@ -0,0 +1,55 @@
|
||||
{ config, lib, ... }: {
|
||||
|
||||
options.sysconfig.docker.searxng.enable = with lib; mkOption {
|
||||
type = with types; bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
config = lib.mkIf (config.sysconfig.docker.searxng.enable && config.sysconfig.docker.enable) {
|
||||
|
||||
networking.firewall.interfaces = {
|
||||
"ve-traefik" = {
|
||||
allowedTCPPorts = [ 9002 ];
|
||||
};
|
||||
};
|
||||
|
||||
virtualisation.oci-containers.containers.searxng = {
|
||||
image = "searxng/searxng:latest";
|
||||
|
||||
# unstable, waiting for 26.05
|
||||
#pull = "newer";
|
||||
|
||||
hostname = "searxng.esotericbytes.com";
|
||||
|
||||
networks = [
|
||||
"docker-main"
|
||||
];
|
||||
|
||||
labels = {
|
||||
"traefik.http.routers.searxng.entrypoints" = "localsecure";
|
||||
"traefik.http.routers.searxng.rule" = "Host(`searxng.esotericbytes.com`)";
|
||||
"traefik.http.routers.searxng.service" = "searxng";
|
||||
"traefik.http.routers.searxng.tls.certResolver" = "cloudflare";
|
||||
|
||||
"traefik.http.services.searxng.loadbalancer.server.url" = "http://192.168.100.10:9002";
|
||||
};
|
||||
|
||||
extraOptions = lib.mkIf config.sysconfig.docker.nvidia [
|
||||
"--ip=192.168.101.5"
|
||||
];
|
||||
|
||||
ports = [
|
||||
"9002:8080"
|
||||
];
|
||||
|
||||
volumes = [
|
||||
"vol_searxng_settings:/etc/searxng/"
|
||||
"vol_searxng_data:/var/cache/searxng/"
|
||||
];
|
||||
|
||||
environment = {
|
||||
SEARXNG_SECRET = "2e8b4fcf4c0f46b097496f2d5715dbb061bd5cac78c64d0f5a0bee27f013f3c0";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user