update nas docker stuff

This commit is contained in:
mjallen18
2024-05-14 11:21:06 -05:00
parent 4c1a95d864
commit 840c7a183c
6 changed files with 208 additions and 20 deletions

View File

@@ -11,7 +11,7 @@ let
allowedPorts = [ 2342 3493 61208 9090 ];
enableDisplayManager = false;
# adding a flag cause nixos cant figure itself out and broke shit that cant be fixed
enableUps = false;
enableUps = true;
in {
imports = [ # Include the results of the hardware scan.
./hardware-configuration.nix
@@ -29,9 +29,11 @@ in {
};
};
powerManagement.cpuFreqGovernor = "powersave";
nas-apps = {
jackett.enable = true;
jellyfin.enable = true;
jellyseerr.enable = true;
@@ -61,6 +63,8 @@ in {
vscode.enable = true;
swag.enable = true;
deluge.enable = true;
};
nas-samba = {
@@ -127,7 +131,7 @@ in {
# Override kernel to latest
kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
kernelParams = [ "nohibernate" ];
kernelParams = [ "nohibernate" "amd_pstate=active" ];
consoleLogLevel = 3;
bootspec.enable = true;
@@ -332,6 +336,9 @@ in {
packagekit
gnome.gnome-packagekit
unstable.nix-inspect
unstable.gpt4all
lm_sensors
htop
];
};
@@ -342,7 +349,7 @@ in {
nix-ld.enable = true;
};
power.ups = {
power.ups.ups = {
enable = enableUps;
mode = "netserver";
ups."nasups" = {
@@ -350,24 +357,40 @@ in {
port = "auto";
description = "NAS UPS";
};
upsmon = {
monitor = "nasups@localhost 1 upsuser BogieDudie1 primary";
};
upsd = {
enable = true;
listen = {
address = 0.0.0.0;
port = 3493;
};
};
users = {
actions = [ "SET" ];
instcmds = [ "ALL" ];
upsmon = "primary";
passwordFile = "/root/ups.conf";
};
};
# Add UPS monitoring service
# services.upsmon = {
# enable = true;
# # Configure UPS device
# device = "/dev/usb/hiddev1"; # Change this to your UPS device
# driver = "usbhid-ups"; # Change this if your UPS uses a different driver
# # Set UPS monitoring options
# options = {
# # NOTIFYCMD = "/path/to/notify-script.sh"; # Path to your notification script
# POLLFREQ = 5;
# POLLFREQALERT = 5;
# HOSTSYNC = "on";
# DEADTIME = 15;
# FINALDELAY = 5;
# };
# };
# power.upsmon = {
# enable = true;
# # Configure UPS device
# device = "/dev/usb/hiddev1"; # Change this to your UPS device
# driver = "usbhid-ups"; # Change this if your UPS uses a different driver
# # Set UPS monitoring options
# options = {
# # NOTIFYCMD = "/path/to/notify-script.sh"; # Path to your notification script
# POLLFREQ = 5;
# POLLFREQALERT = 5;
# HOSTSYNC = "on";
# DEADTIME = 15;
# FINALDELAY = 5;
# };
# };
# Configure nixpkgs
nixpkgs = {

View File

@@ -0,0 +1,38 @@
{ lib, pkgs, config, ... }:
with lib;
let cfg = config.nas-apps.deluge;
in {
imports = [ ./options.nix ];
config = mkIf cfg.enable {
systemd.services.deluge-docker = {
path = [ pkgs.bash pkgs.docker ];
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" ];
};
};
}

View File

@@ -0,0 +1,52 @@
{ lib, ... }:
with lib; {
options.nas-apps.deluge = {
enable = mkEnableOption "deluge docker service";
autoStart = mkOption {
type = types.bool;
default = true;
};
name = mkOption {
type = types.str;
default = "deluge";
};
image = mkOption {
type = types.str;
default = "binhex/arch-delugevpn";
};
configPath = mkOption {
type = types.str;
default = "/mnt/ssd/nix-app-data/deluge";
};
moviesPath = mkOption {
type = types.str;
default = "/mnt/ssd/ssd_app_data/downloads";
};
tvPath = mkOption {
type = types.str;
default = "/mnt/ssd/ssd_app_data/downloads-incomplete";
};
puid = mkOption {
type = types.str;
default = "0";
};
pgid = mkOption {
type = types.str;
default = "0";
};
timeZone = mkOption {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -0,0 +1,23 @@
{ lib, pkgs, config, ... }:
with lib;
let cfg = config.nas-apps.jackett;
in {
imports = [ ./options.nix ];
config = mkIf cfg.enable {
virtualisation.oci-containers.containers."${cfg.name}" = {
autoStart = cfg.autoStart;
image = cfg.image;
ports = [ "${cfg.port}:9117" ];
volumes = [
"${cfg.configPath}:/config"
"${cfg.downloadsPath}:/downloads"
];
environment = {
PUID = cfg.puid;
PGID = cfg.pgid;
TZ = cfg.timeZone;
};
};
};
}

View File

@@ -0,0 +1,51 @@
{ lib, ... }:
with lib; {
options.nas-apps.jackett = {
enable = mkEnableOption "jackett docker service";
autoStart = mkOption {
type = types.bool;
default = true;
};
port = mkOption {
type = types.str;
default = "9117";
};
name = mkOption {
type = types.str;
default = "jackett";
};
image = mkOption {
type = types.str;
default = "linuxserver/jackett";
};
configPath = mkOption {
type = types.str;
default = "/mnt/ssd/nix-app-data/jackett";
};
downloadsPath = mkOption {
type = types.str;
default = "/mnt/ssd/ssd_app_data/downloads";
};
puid = mkOption {
type = types.str;
default = "911";
};
pgid = mkOption {
type = types.str;
default = "1000";
};
timeZone = mkOption {
type = types.str;
default = "America/Chicago";
};
};
}

View File

@@ -2,10 +2,11 @@
imports = [
./samba
./apps/collabora
# ./apps/dashy
./apps/deluge
./apps/discover-wrapped
./apps/homarr
./apps/homepage
./apps/jackett
./apps/jellyfin
./apps/jellyseerr
./apps/mariadb