This commit is contained in:
mjallen18
2024-08-07 18:41:09 -05:00
parent 26cc1b223f
commit 0fc00e2d29
26 changed files with 683 additions and 202 deletions

View File

@@ -23,12 +23,13 @@ in
volumes = [
# ...
];
environmentFiles = cfg.environmentFiles;
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
username = cfg.username;
password = cfg.password;
# password = cfg.password; # get from env file
domain = "office.mjallen.dev";
aliasgroup1 = "https://cloud\.mjallen\.dev:443";
aliasgroup2 = "https://cloud\.mjallen\.dev:443";

View File

@@ -44,9 +44,9 @@ with lib;
default = "mjallen";
};
password = mkOption {
type = types.str;
default = "BogieDudie1";
environmentFiles = mkOption {
type = with types; listOf path;
default = [];
};
dontGenSslCert = mkOption {

View File

@@ -13,36 +13,34 @@ in
config = mkIf cfg.enable {
systemd.services.deluge-docker = {
path = [
pkgs.bash
pkgs.docker
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [
"${toString cfg.port1}:8112"
"${toString cfg.port2}:8118"
"${toString cfg.port3}:58846"
"${toString cfg.port4}:58966"
];
script = ''
set -e
exec docker run \
--rm \
--cap-add=NET_ADMIN \
--name=${cfg.name} \
-e PUID=${cfg.puid} \
-e PGID=${cfg.pgid} \
-e TZ=${cfg.timeZone} \
-p 8112:8112 \
-p 8118:8118 \
-p 58846:58846 \
-p 58946:58966 \
-v '${cfg.configPath}:/config' \
-v '${cfg.moviesPath}:/data/downloads' \
-v '${cfg.tvPath}:/data/downloads-icomplete' \
-v /etc/localtime:/etc/localtime:ro \
-e VPN_ENABLED=yes \
-e VPN_PROV=custom \
-e VPN_CLIENT=openvpn \
-e LAN_NETWORK=10.0.1.0/24 \
-e NAME_SERVERS=1.1.1.1 \
${cfg.image}:latest
'';
wantedBy = [ "multi-user.target" ];
extraOptions = [
"--cap-add=NET_ADMIN"
];
volumes = [
"${cfg.configPath}:/config"
"${cfg.moviesPath}:/data/downloads"
"${cfg.tvPath}:/data/downloads-icomplete"
"/etc/localtime:/etc/localtime:ro"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
VPN_ENABLED = "yes";
VPN_PROV = "custom";
VPN_CLIENT = "openvpn";
LAN_NETWORK = "10.0.1.0/24";
NAME_SERVERS = "1.1.1.1";
};
};
};
}

View File

@@ -14,6 +14,26 @@ with lib;
default = "deluge";
};
port1 = mkOption {
type = types.str;
default = "8112";
};
port2 = mkOption {
type = types.str;
default = "8118";
};
port3 = mkOption {
type = types.str;
default = "58846";
};
port4 = mkOption {
type = types.str;
default = "58966";
};
image = mkOption {
type = types.str;
default = "binhex/arch-delugevpn";

View File

@@ -17,14 +17,15 @@ in
image = cfg.image;
ports = [ "${cfg.port}:3306" ];
volumes = [ "${cfg.configPath}:/config" ];
environmentFiles = cfg.environmentFiles;
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
MYSQL_ROOT_PASSWORD = cfg.rootPassword;
# MYSQL_ROOT_PASSWORD = cfg.rootPassword; # get from env file
MYSQL_DATABASE = cfg.databaseName;
MYSQL_USER = cfg.databaseUser;
MYSQL_PASSWORD = cfg.databasePassword;
# MYSQL_PASSWORD = cfg.databasePassword; # get from env file
};
};
};

View File

@@ -44,11 +44,6 @@ with lib;
default = "America/Chicago";
};
rootPassword = mkOption {
type = types.str;
default = "BogieDudie1";
};
databaseName = mkOption {
type = types.str;
default = "jallen_nextcloud";
@@ -59,9 +54,9 @@ with lib;
default = "nextcloud";
};
databasePassword = mkOption {
type = types.str;
default = "BogieDudie1";
environmentFiles = mkOption {
type = with types; listOf path;
default = [];
};
};
}

View File

@@ -22,14 +22,12 @@ in
volumes = [
"${cfg.configPath}:/config"
"${cfg.dataPath}:/data"
"${cfg.redisSock}:/var/redis/redis.sock"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
REDIS_HOST = "10.0.1.18";
REDIS_PORT = "6379";
REDIS_HOST_PASSWORD = "BogieDudie1";
};
};
};

View File

@@ -39,6 +39,11 @@ with lib;
default = "/media/nas/main/nextcloud";
};
redisSock = mkOption {
type = types.str;
default = "";
};
puid = mkOption {
type = types.str;
default = "911";

View File

@@ -1,26 +0,0 @@
{
lib,
pkgs,
config,
...
}:
with lib;
let
cfg = config.nas-apps.redis;
in
{
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
cmd = [
"redis-server"
"--requirepass"
"BogieDudie1"
];
ports = [ "6379:6379" ];
};
};
}

View File

@@ -1,27 +0,0 @@
{ lib, ... }:
with lib;
{
options.nas-apps.redis = {
enable = mkEnableOption "redis docker service";
autoStart = mkOption {
type = types.bool;
default = true;
};
name = mkOption {
type = types.str;
default = "redis";
};
image = mkOption {
type = types.str;
default = "redis";
};
cmd = mkOption {
type = types.str;
default = "redis-server --requirepass BogieDudie1";
};
};
}