created vars.nix for jeeves and set up envvars

This commit is contained in:
Richie Cahill 2024-06-27 21:38:29 -04:00
parent e6cacdccc1
commit e0f2d2a856
8 changed files with 70 additions and 26 deletions

View File

@ -1,4 +1,7 @@
{ pkgs, ... }: { pkgs, ... }:
let
vars = import ./vars.nix;
in
{ {
imports = [ imports = [
../../users/richie/global/ssh.nix ../../users/richie/global/ssh.nix
@ -43,6 +46,12 @@
mode = "0440"; mode = "0440";
}; };
}; };
variables = {
ZFS_MEDIA = vars.zfs_media;
ZFS_STORAGE = vars.zfs_storage;
ZFS_STORAGE_PLEX = vars.storage_plex;
ZFS_TORRENTING = vars.zfs_torrenting;
};
}; };
services = { services = {
@ -52,7 +61,7 @@
plex = { plex = {
enable = true; enable = true;
dataDir = "/zfs/media/plex/"; dataDir = vars.media_plex;
}; };
smartd.enable = true; smartd.enable = true;
@ -63,7 +72,7 @@
syncthing.settings.folders = { syncthing.settings.folders = {
"notes" = { "notes" = {
id = "l62ul-lpweo"; # cspell:disable-line id = "l62ul-lpweo"; # cspell:disable-line
path = "/zfs/media/notes"; path = vars.media_notes;
devices = [ devices = [
"bob" "bob"
"phone" "phone"
@ -73,7 +82,7 @@
}; };
"books" = { "books" = {
id = "6uppx-vadmy"; # cspell:disable-line id = "6uppx-vadmy"; # cspell:disable-line
path = "/zfs/storage/syncthing/books"; path = "${vars.storage_syncthing}/books";
devices = [ devices = [
"bob" "bob"
"phone" "phone"
@ -83,7 +92,7 @@
}; };
"important" = { "important" = {
id = "4ckma-gtshs"; # cspell:disable-line id = "4ckma-gtshs"; # cspell:disable-line
path = "/zfs/storage/syncthing/important"; path = "${vars.storage_syncthing}/important";
devices = [ devices = [
"bob" "bob"
"phone" "phone"
@ -93,7 +102,7 @@
}; };
"music" = { "music" = {
id = "vprc5-3azqc"; # cspell:disable-line id = "vprc5-3azqc"; # cspell:disable-line
path = "/zfs/storage/syncthing/music"; path = "${vars.storage_syncthing}/music";
devices = [ devices = [
"bob" "bob"
"phone" "phone"
@ -103,7 +112,7 @@
}; };
"projects" = { "projects" = {
id = "vyma6-lqqrz"; # cspell:disable-line id = "vyma6-lqqrz"; # cspell:disable-line
path = "/zfs/storage/syncthing/projects"; path = "${vars.storage_syncthing}/projects";
devices = [ devices = [
"bob" "bob"
"rhapsody-in-green" "rhapsody-in-green"

View File

@ -1,10 +1,13 @@
let
vars = import ../vars.nix;
in
{ {
virtualisation.oci-containers.containers.filebrowser = { virtualisation.oci-containers.containers.filebrowser = {
image = "hurlenko/filebrowser"; image = "hurlenko/filebrowser";
extraOptions = [ "--network=web" ]; extraOptions = [ "--network=web" ];
volumes = [ volumes = [
"/zfs:/data" "/zfs:/data"
"/zfs/media/docker/configs/filebrowser:/config" "${vars.media_docker_configs}/filebrowser:/config"
]; ];
autoStart = true; autoStart = true;
user = "1000:users"; user = "1000:users";

View File

@ -1,4 +1,7 @@
{ config, ... }: { config, ... }:
let
vars = import ../vars.nix;
in
{ {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
qbit = { qbit = {
@ -10,8 +13,8 @@
"29432:29432" "29432:29432"
]; ];
volumes = [ volumes = [
"/zfs/media/docker/configs/qbit:/config" "${vars.media_docker_configs}/qbit:/config"
"/zfs/torrenting/qbit/:/data" "${vars.torrenting_qbit}:/data"
]; ];
environment = { environment = {
PUID = "600"; PUID = "600";
@ -31,8 +34,8 @@
"8118:8118" "8118:8118"
]; ];
volumes = [ volumes = [
"/zfs/media/docker/configs/qbitvpn:/config" "${vars.media_docker_configs}/qbitvpn:/config"
"/zfs/torrenting/qbitvpn/:/data" "${vars.torrenting_qbitvpn}:/data"
"/etc/localtime:/etc/localtime:ro" "/etc/localtime:/etc/localtime:ro"
]; ];
environment = { environment = {
@ -61,7 +64,7 @@
PGID = "100"; PGID = "100";
TZ = "America/New_York"; TZ = "America/New_York";
}; };
volumes = [ "/zfs/media/docker/configs/prowlarr:/config" ]; volumes = [ "${vars.media_docker_configs}/prowlarr:/config" ];
autoStart = true; autoStart = true;
}; };
radarr = { radarr = {
@ -73,9 +76,9 @@
TZ = "America/New_York"; TZ = "America/New_York";
}; };
volumes = [ volumes = [
"/zfs/media/docker/configs/radarr:/config" "${vars.media_docker_configs}/radarr:/config"
"/zfs/storage/plex/movies:/movies" "${vars.storage_plex}/movies:/movies"
"/zfs/torrenting/qbitvpn:/data" "${vars.torrenting_qbitvpn}:/data"
]; ];
autoStart = true; autoStart = true;
}; };
@ -88,9 +91,9 @@
TZ = "America/New_York"; TZ = "America/New_York";
}; };
volumes = [ volumes = [
"/zfs/media/docker/configs/sonarr:/config" "${vars.media_docker_configs}/sonarr:/config"
"/zfs/storage/plex/tv:/tv" "${vars.storage_plex}/tv:/tv"
"/zfs/torrenting/qbitvpn:/data" "${vars.torrenting_qbitvpn}:/data"
]; ];
autoStart = true; autoStart = true;
}; };

View File

@ -1,4 +1,7 @@
{ config, ... }: { config, ... }:
let
vars = import ../vars.nix;
in
{ {
users = { users = {
users.postgres = { users.postgres = {
@ -15,7 +18,7 @@
postgres = { postgres = {
image = "postgres:16"; image = "postgres:16";
ports = [ "5432:5432" ]; ports = [ "5432:5432" ];
volumes = [ "/zfs/media/databases/postgres:/var/lib/postgresql/data" ]; volumes = [ "${vars.media_database}/postgres:/var/lib/postgresql/data" ];
environment = { environment = {
POSTGRES_USER = "admin"; POSTGRES_USER = "admin";
POSTGRES_DB = "archive"; POSTGRES_DB = "archive";

View File

@ -1,9 +1,12 @@
{ config, ... }: { config, ... }:
let
vars = import ../vars.nix;
in
{ {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
grafana = { grafana = {
image = "grafana/grafana-enterprise"; image = "grafana/grafana-enterprise";
volumes = [ "/zfs/media/docker/configs/grafana:/var/lib/grafana" ]; volumes = [ "${vars.media_docker_configs}/grafana:/var/lib/grafana" ];
user = "600:600"; user = "600:600";
extraOptions = [ "--network=web" ]; extraOptions = [ "--network=web" ];
autoStart = true; autoStart = true;
@ -11,8 +14,8 @@
dnd_file_server = { dnd_file_server = {
image = "ubuntu/apache2:latest"; image = "ubuntu/apache2:latest";
volumes = [ volumes = [
"/zfs/media/docker/templates/file_server/sites/:/etc/apache2/sites-enabled/" "${vars.media_docker_templates}/file_server/sites/:/etc/apache2/sites-enabled/"
"/zfs/storage/main/Table_Top/:/data" "${vars.storage_main}/Table_Top/:/data"
]; ];
extraOptions = [ "--network=web" ]; extraOptions = [ "--network=web" ];
autoStart = true; autoStart = true;
@ -20,8 +23,8 @@
arch_mirror = { arch_mirror = {
image = "ubuntu/apache2:latest"; image = "ubuntu/apache2:latest";
volumes = [ volumes = [
"/zfs/media/docker/templates/file_server/sites/:/etc/apache2/sites-enabled/" "${vars.media_docker_templates}/file_server/sites/:/etc/apache2/sites-enabled/"
"/zfs/media/mirror/:/data" "${vars.media_mirror}:/data"
]; ];
ports = [ "800:80" ]; ports = [ "800:80" ];
extraOptions = [ "--network=web" ]; extraOptions = [ "--network=web" ];

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
plex_dir="/zfs/storage/plex/" plex_dir=$ZFS_STORAGE_PLEX
chown docker-service:users -R "$plex_dir" chown docker-service:users -R "$plex_dir"
find "$plex_dir" -type f -exec chmod 664 {} \; find "$plex_dir" -type f -exec chmod 664 {} \;

22
systems/jeeves/vars.nix Normal file
View File

@ -0,0 +1,22 @@
let
zfs_storage = "/zfs/storage";
zfs_torrenting = "/zfs/torrenting";
zfs_media = "/zfs/media";
in
{
# media
media_database = "${zfs_media}/syncthing/database";
media_docker = "${zfs_media}/docker";
media_docker_configs = "${zfs_media}/docker/configs";
media_docker_templates = "${zfs_media}/docker/templates";
media_mirror = "${zfs_media}/mirror";
media_notes = "${zfs_media}/notes";
media_plex = "${zfs_media}/plex/";
# storage
storage_main = "${zfs_storage}/main";
storage_plex = "${zfs_storage}/plex";
storage_syncthing = "${zfs_storage}/syncthing";
# torrenting
torrenting_qbit = "${zfs_torrenting}/qbit";
torrenting_qbitvpn = "${zfs_torrenting}/qbitvpn";
}

View File

@ -57,5 +57,6 @@
"github.copilot.enable": { "github.copilot.enable": {
"*": false "*": false
}, },
"terminal.integrated.scrollback": 10000 "terminal.integrated.scrollback": 10000,
"diffEditor.ignoreTrimWhitespace": false
} }