cleanup
This commit is contained in:
@@ -20,6 +20,73 @@
|
||||
];
|
||||
|
||||
nas-apps = {
|
||||
actual = {
|
||||
enable = true;
|
||||
port = 3333;
|
||||
localAddress = "10.0.3.18";
|
||||
dataDir = "/media/nas/ssd/nix-app-data/actual";
|
||||
reverseProxy = {
|
||||
enable = true;
|
||||
host = "actual.mjallen.dev";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
};
|
||||
};
|
||||
|
||||
arrs = {
|
||||
enable = true;
|
||||
localAddress = "10.0.1.51";
|
||||
downloadsDir = "/media/nas/ssd/ssd_app_data/downloads";
|
||||
incompleteDownloadsDir = "/media/nas/ssd/ssd_app_data/downloads-incomplete";
|
||||
moviesDir = "/media/nas/main/movies";
|
||||
tvDir = "/media/nas/main/tv";
|
||||
isosDir = "/media/nas/main/isos";
|
||||
radarr = {
|
||||
enable = true;
|
||||
port = 7878;
|
||||
dataDir = "/media/nas/ssd/nix-app-data/radarr";
|
||||
};
|
||||
sonarr = {
|
||||
enable = true;
|
||||
port = 8989;
|
||||
dataDir = "/media/nas/ssd/nix-app-data/sonarr";
|
||||
};
|
||||
sabnzbd = {
|
||||
enable = true;
|
||||
port = 8280;
|
||||
dataDir = "/media/nas/ssd/nix-app-data/sabnzbd";
|
||||
};
|
||||
deluge = {
|
||||
enable = true;
|
||||
port = 8112;
|
||||
};
|
||||
jackett = {
|
||||
enable = true;
|
||||
port = 9117;
|
||||
dataDir = "/media/nas/ssd/nix-app-data/jackett";
|
||||
};
|
||||
};
|
||||
|
||||
crowdsec = {
|
||||
enable = true;
|
||||
port = 9898;
|
||||
apiAddress = "10.0.1.18";
|
||||
apiKey = "1daH89qmJ41r2Lpd9hvDw4sxtOAtBzaj3aKFOFqE";
|
||||
dataDir = "/media/nas/ssd/nix-app-data/crowdsec";
|
||||
};
|
||||
|
||||
gitea = {
|
||||
enable = true;
|
||||
httpPort = 3000;
|
||||
sshPort = 2222;
|
||||
localAddress = "10.0.4.18";
|
||||
dataDir = "/media/nas/ssd/nix-app-data/gitea";
|
||||
reverseProxy = {
|
||||
enable = true;
|
||||
host = "gitea.mjallen.dev";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
};
|
||||
};
|
||||
|
||||
free-games-claimer.enable = true;
|
||||
|
||||
manyfold.enable = true;
|
||||
|
||||
@@ -1,100 +1,124 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
actualPort = 3333;
|
||||
hostDataDir = "/media/nas/ssd/nix-app-data/actual";
|
||||
cfg = config.nas-apps.actual;
|
||||
dataDir = "/data";
|
||||
hostAddress = "10.0.1.18";
|
||||
localAddress = "10.0.3.18";
|
||||
actualUserId = config.users.users.nix-apps.uid;
|
||||
actualGroupId = config.users.groups.jallen-nas.gid;
|
||||
in
|
||||
{
|
||||
containers.actual = {
|
||||
autoStart = true;
|
||||
privateNetwork = true;
|
||||
hostAddress = hostAddress;
|
||||
localAddress = localAddress;
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
bindMounts = {
|
||||
${dataDir} = {
|
||||
hostPath = hostDataDir;
|
||||
isReadOnly = false;
|
||||
config = mkIf cfg.enable {
|
||||
containers.actual = {
|
||||
autoStart = true;
|
||||
privateNetwork = true;
|
||||
hostAddress = hostAddress;
|
||||
localAddress = cfg.localAddress;
|
||||
|
||||
bindMounts = {
|
||||
${dataDir} = {
|
||||
hostPath = cfg.dataDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
};
|
||||
|
||||
config = { lib, ... }:
|
||||
{
|
||||
services.actual = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
settings = {
|
||||
trustedProxies = [ hostAddress ];
|
||||
port = cfg.port;
|
||||
dataDir = dataDir;
|
||||
serverFiles = "${dataDir}/server-files";
|
||||
userFiles = "${dataDir}/user-files";
|
||||
};
|
||||
};
|
||||
|
||||
users.users.actual = {
|
||||
isSystemUser = true;
|
||||
uid = lib.mkForce actualUserId;
|
||||
group = "actual";
|
||||
};
|
||||
|
||||
users.groups = {
|
||||
actual = {
|
||||
gid = lib.mkForce actualGroupId;
|
||||
};
|
||||
};
|
||||
|
||||
# System packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
sqlite
|
||||
];
|
||||
|
||||
# Create and set permissions for required directories
|
||||
system.activationScripts.actual-dirs = ''
|
||||
mkdir -p ${dataDir}
|
||||
chown -R actual:actual ${dataDir}
|
||||
chmod -R 0700 ${dataDir}
|
||||
'';
|
||||
|
||||
systemd.services = {
|
||||
actual = {
|
||||
environment.ACTUAL_CONFIG_PATH = lib.mkForce "${dataDir}/config.json";
|
||||
serviceConfig = {
|
||||
ExecStart = lib.mkForce "${pkgs.actual-server}/bin/actual-server --config ${dataDir}/config.json";
|
||||
WorkingDirectory = lib.mkForce dataDir;
|
||||
StateDirectory = lib.mkForce dataDir;
|
||||
StateDirectoryMode = lib.mkForce 0700;
|
||||
DynamicUser = lib.mkForce false;
|
||||
ProtectSystem = lib.mkForce null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ cfg.port ];
|
||||
};
|
||||
# Use systemd-resolved inside the container
|
||||
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
|
||||
useHostResolvConf = lib.mkForce false;
|
||||
};
|
||||
|
||||
services.resolved.enable = true;
|
||||
system.stateVersion = "23.11";
|
||||
};
|
||||
};
|
||||
|
||||
services.traefik.dynamicConfigOptions = lib.mkIf cfg.reverseProxy.enable {
|
||||
services.actual.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://${cfg.localAddress}:${toString cfg.port}";
|
||||
}
|
||||
];
|
||||
routers.actual = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`${cfg.reverseProxy.host}`)";
|
||||
service = "actual";
|
||||
middlewares = cfg.reverseProxy.middlewares;
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
};
|
||||
|
||||
config = { lib, ... }:
|
||||
{
|
||||
services.actual = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
settings = {
|
||||
trustedProxies = [ hostAddress ];
|
||||
port = actualPort;
|
||||
dataDir = dataDir;
|
||||
serverFiles = "${dataDir}/server-files";
|
||||
userFiles = "${dataDir}/user-files";
|
||||
};
|
||||
};
|
||||
|
||||
users.users.actual = {
|
||||
isSystemUser = true;
|
||||
uid = lib.mkForce actualUserId;
|
||||
group = "actual";
|
||||
};
|
||||
|
||||
users.groups = {
|
||||
actual = {
|
||||
gid = lib.mkForce actualGroupId;
|
||||
};
|
||||
};
|
||||
|
||||
# System packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
sqlite
|
||||
networking = {
|
||||
nat = {
|
||||
forwardPorts = [
|
||||
{
|
||||
destination = "${cfg.localAddress}:${toString cfg.port}";
|
||||
sourcePort = cfg.port;
|
||||
}
|
||||
];
|
||||
|
||||
# Create and set permissions for required directories
|
||||
system.activationScripts.actual-dirs = ''
|
||||
mkdir -p ${dataDir}
|
||||
chown -R actual:actual ${dataDir}
|
||||
chmod -R 0700 ${dataDir}
|
||||
'';
|
||||
|
||||
systemd.services = {
|
||||
actual = {
|
||||
environment.ACTUAL_CONFIG_PATH = lib.mkForce "${dataDir}/config.json";
|
||||
serviceConfig = {
|
||||
ExecStart = lib.mkForce "${pkgs.actual-server}/bin/actual-server --config ${dataDir}/config.json";
|
||||
WorkingDirectory = lib.mkForce dataDir;
|
||||
StateDirectory = lib.mkForce dataDir;
|
||||
StateDirectoryMode = lib.mkForce 0700;
|
||||
DynamicUser = lib.mkForce false;
|
||||
ProtectSystem = lib.mkForce null;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ actualPort ];
|
||||
};
|
||||
# Use systemd-resolved inside the container
|
||||
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
|
||||
useHostResolvConf = lib.mkForce false;
|
||||
};
|
||||
|
||||
services.resolved.enable = true;
|
||||
system.stateVersion = "23.11";
|
||||
};
|
||||
};
|
||||
|
||||
networking.nat = {
|
||||
forwardPorts = [
|
||||
{
|
||||
destination = "${localAddress}:${toString actualPort}";
|
||||
sourcePort = actualPort;
|
||||
}
|
||||
];
|
||||
firewall = {
|
||||
allowedTCPPorts = [ cfg.port ];
|
||||
allowedUDPPorts = [ cfg.port ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
37
hosts/nas/apps/actual/options.nix
Normal file
37
hosts/nas/apps/actual/options.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.nas-apps.actual = {
|
||||
enable = mkEnableOption "actual service";
|
||||
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 80;
|
||||
};
|
||||
|
||||
localAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
reverseProxy = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
middlewares = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,15 +1,12 @@
|
||||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
|
||||
with lib;
|
||||
let
|
||||
radarrPort = 7878;
|
||||
sonarrPort = 8989;
|
||||
sabnzbdPort = 8280;
|
||||
delugePort = 8112;
|
||||
jackettPort = 9117;
|
||||
cfg = config.nas-apps.arrs;
|
||||
radarrDataDir = "/var/lib/radarr";
|
||||
downloadDir = "/downloads";
|
||||
incompleteDir = "/downloads-incomplete";
|
||||
@@ -19,210 +16,220 @@ let
|
||||
mediaDir = "/media";
|
||||
arrUserId = config.users.users.nix-apps.uid;
|
||||
arrGroupId = config.users.groups.jallen-nas.gid;
|
||||
radarrPkg = pkgs.unstable.radarr;
|
||||
sonarrPkg = pkgs.unstable.sonarr;
|
||||
delugePkg = pkgs.unstable.deluge;
|
||||
jackettPkg = pkgs.unstable.jackett;
|
||||
sabnzbdPkg = pkgs.unstable.sabnzbd;
|
||||
radarrPkg = pkgs.radarr;
|
||||
sonarrPkg = pkgs.sonarr;
|
||||
delugePkg = pkgs.deluge;
|
||||
jackettPkg = pkgs.jackett;
|
||||
sabnzbdPkg = pkgs.sabnzbd;
|
||||
in
|
||||
{
|
||||
containers.arrs = {
|
||||
autoStart = true;
|
||||
privateNetwork = true;
|
||||
hostAddress = "10.0.1.18";
|
||||
localAddress = "10.0.1.51";
|
||||
imports = [ ./options.nix ];
|
||||
|
||||
config =
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
config = mkIf cfg.enable {
|
||||
containers.arrs = {
|
||||
autoStart = true;
|
||||
privateNetwork = true;
|
||||
hostAddress = "10.0.1.18";
|
||||
localAddress = cfg.localAddress;
|
||||
|
||||
# Enable radarr service
|
||||
services.radarr = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
dataDir = radarrDataDir;
|
||||
package = radarrPkg;
|
||||
};
|
||||
config =
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
{
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
|
||||
# Enable Sonarr service
|
||||
services.sonarr = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
dataDir = sonarrDataDir;
|
||||
package = sonarrPkg;
|
||||
};
|
||||
|
||||
# Enable Sabnzbd service
|
||||
services.sabnzbd = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
configFile = "${sabnzbdConfig}/sabnzbd.ini";
|
||||
package = sabnzbdPkg;
|
||||
};
|
||||
|
||||
services.deluge = {
|
||||
enable = true;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
openFirewall = true;
|
||||
dataDir = "/media";
|
||||
package = delugePkg;
|
||||
web = {
|
||||
enable = true;
|
||||
port = 8112;
|
||||
# Enable radarr service
|
||||
services.radarr = {
|
||||
enable = cfg.radarr.enable;
|
||||
openFirewall = true;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
dataDir = cfg.radarr.dataDir;
|
||||
package = radarrPkg;
|
||||
};
|
||||
};
|
||||
|
||||
services.jackett = {
|
||||
enable = true;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
openFirewall = true;
|
||||
package = jackettPkg;
|
||||
};
|
||||
|
||||
# Create required users and groups
|
||||
users.users.arrs = {
|
||||
isSystemUser = true;
|
||||
uid = lib.mkForce arrUserId;
|
||||
group = "media";
|
||||
extraGroups = [ "downloads" ];
|
||||
};
|
||||
|
||||
users.groups = {
|
||||
media = {
|
||||
gid = lib.mkForce arrGroupId;
|
||||
# Enable Sonarr service
|
||||
services.sonarr = {
|
||||
enable = cfg.sonarr.enable;
|
||||
openFirewall = true;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
dataDir = cfg.sonarr.dataDir;
|
||||
package = sonarrPkg;
|
||||
};
|
||||
downloads = { };
|
||||
|
||||
# Enable Sabnzbd service
|
||||
services.sabnzbd = {
|
||||
enable = cfg.sabnzbd.enable;
|
||||
openFirewall = true;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
configFile = "${cfg.sabnzbd.dataDir}/sabnzbd.ini";
|
||||
package = sabnzbdPkg;
|
||||
};
|
||||
|
||||
services.deluge = {
|
||||
enable = cfg.deluge.enable;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
openFirewall = true;
|
||||
dataDir = "/media";
|
||||
package = delugePkg;
|
||||
web = {
|
||||
enable = true;
|
||||
port = cfg.deluge.port;
|
||||
openFirewall = true;
|
||||
};
|
||||
};
|
||||
|
||||
services.jackett = {
|
||||
enable = cfg.jackett.enable;
|
||||
user = "arrs";
|
||||
group = "media";
|
||||
openFirewall = true;
|
||||
package = jackettPkg;
|
||||
};
|
||||
|
||||
# Create required users and groups
|
||||
users.users.arrs = {
|
||||
isSystemUser = true;
|
||||
uid = lib.mkForce arrUserId;
|
||||
group = "media";
|
||||
extraGroups = [ "downloads" ];
|
||||
};
|
||||
|
||||
users.groups = {
|
||||
media = {
|
||||
gid = lib.mkForce arrGroupId;
|
||||
};
|
||||
downloads = { };
|
||||
};
|
||||
|
||||
# System packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
glib
|
||||
sqlite
|
||||
mono
|
||||
mediainfo
|
||||
protonvpn-cli_2
|
||||
];
|
||||
|
||||
# Create and set permissions for required directories
|
||||
system.activationScripts.arr-dirs = ''
|
||||
mkdir -p ${radarrDataDir}
|
||||
mkdir -p ${sonarrDataDir}
|
||||
mkdir -p ${sabnzbdConfig}
|
||||
mkdir -p ${downloadDir}
|
||||
mkdir -p ${incompleteDir}
|
||||
mkdir -p ${mediaDir}
|
||||
|
||||
chown -R arrs:media ${radarrDataDir}
|
||||
chown -R arrs:media ${sonarrDataDir}
|
||||
chown -R arrs:media ${sabnzbdConfig}
|
||||
chown -R arrs:media ${downloadDir}
|
||||
chown -R arrs:media ${incompleteDir}
|
||||
chown -R arrs:media ${mediaDir}
|
||||
|
||||
chmod -R 775 ${radarrDataDir}
|
||||
chmod -R 775 ${sonarrDataDir}
|
||||
chmod -R 775 ${sabnzbdConfig}
|
||||
chmod -R 775 ${downloadDir}
|
||||
chmod -R 775 ${incompleteDir}
|
||||
chmod -R 775 ${mediaDir}
|
||||
|
||||
'';
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [
|
||||
cfg.radarr.port
|
||||
cfg.sonarr.port
|
||||
cfg.sabnzbd.port
|
||||
];
|
||||
};
|
||||
# Use systemd-resolved inside the container
|
||||
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
|
||||
useHostResolvConf = lib.mkForce false;
|
||||
};
|
||||
|
||||
services.resolved.enable = true;
|
||||
system.stateVersion = "23.11";
|
||||
};
|
||||
|
||||
# System packages
|
||||
environment.systemPackages = with pkgs; [
|
||||
glib
|
||||
sqlite
|
||||
mono
|
||||
mediainfo
|
||||
protonvpn-cli_2
|
||||
# Bind mount directories from host
|
||||
bindMounts = {
|
||||
"${radarrDataDir}" = {
|
||||
hostPath = cfg.radarr.dataDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${sonarrDataDir}" = {
|
||||
hostPath = cfg.sonarr.dataDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${sabnzbdConfig}" = {
|
||||
hostPath = cfg.sabnzbd.dataDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${downloadDir}" = {
|
||||
hostPath = cfg.downloadsDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${incompleteDir}" = {
|
||||
hostPath = cfg.incompleteDownloadsDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${jackettDir}" = {
|
||||
hostPath = cfg.jackett.dataDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
"/media/movies" = {
|
||||
hostPath = cfg.moviesDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
"/media/tv" = {
|
||||
hostPath = cfg.tvDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
"/media/isos" = {
|
||||
hostPath = cfg.isosDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking = {
|
||||
nat = {
|
||||
forwardPorts = [
|
||||
{
|
||||
destination = "${cfg.localAddress}:${toString cfg.radarr.port}";
|
||||
sourcePort = cfg.radarr.port;
|
||||
}
|
||||
{
|
||||
destination = "${cfg.localAddress}:${toString cfg.sonarr.port}";
|
||||
sourcePort = cfg.sonarr.port;
|
||||
}
|
||||
{
|
||||
destination = "${cfg.localAddress}:${toString cfg.sabnzbd.port}";
|
||||
sourcePort = cfg.sabnzbd.port;
|
||||
}
|
||||
{
|
||||
destination = "${cfg.localAddress}:${toString cfg.deluge.port}";
|
||||
sourcePort = cfg.deluge.port;
|
||||
}
|
||||
{
|
||||
destination = "${cfg.localAddress}:${toString cfg.jackett.port}";
|
||||
sourcePort = cfg.jackett.port;
|
||||
}
|
||||
];
|
||||
|
||||
# Create and set permissions for required directories
|
||||
system.activationScripts.radarr-dirs = ''
|
||||
mkdir -p ${radarrDataDir}
|
||||
mkdir -p ${sonarrDataDir}
|
||||
mkdir -p ${sabnzbdConfig}
|
||||
mkdir -p ${downloadDir}
|
||||
mkdir -p ${incompleteDir}
|
||||
mkdir -p ${mediaDir}
|
||||
|
||||
chown -R arrs:media ${radarrDataDir}
|
||||
chown -R arrs:media ${sonarrDataDir}
|
||||
chown -R arrs:media ${sabnzbdConfig}
|
||||
chown -R arrs:media ${downloadDir}
|
||||
chown -R arrs:media ${incompleteDir}
|
||||
chown -R arrs:media ${mediaDir}
|
||||
|
||||
chmod -R 775 ${radarrDataDir}
|
||||
chmod -R 775 ${sonarrDataDir}
|
||||
chmod -R 775 ${sabnzbdConfig}
|
||||
chmod -R 775 ${downloadDir}
|
||||
chmod -R 775 ${incompleteDir}
|
||||
chmod -R 775 ${mediaDir}
|
||||
|
||||
'';
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [
|
||||
radarrPort
|
||||
sonarrPort
|
||||
sabnzbdPort
|
||||
];
|
||||
};
|
||||
# Use systemd-resolved inside the container
|
||||
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
|
||||
useHostResolvConf = lib.mkForce false;
|
||||
};
|
||||
|
||||
services.resolved.enable = true;
|
||||
system.stateVersion = "23.11";
|
||||
};
|
||||
|
||||
# Bind mount directories from host
|
||||
bindMounts = {
|
||||
"${radarrDataDir}" = {
|
||||
hostPath = "/media/nas/ssd/nix-app-data/radarr";
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${sonarrDataDir}" = {
|
||||
hostPath = "/media/nas/ssd/nix-app-data/sonarr";
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${sabnzbdConfig}" = {
|
||||
hostPath = "/media/nas/ssd/nix-app-data/sabnzbd";
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${downloadDir}" = {
|
||||
hostPath = "/media/nas/ssd/ssd_app_data/downloads";
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${incompleteDir}" = {
|
||||
hostPath = "/media/nas/ssd/ssd_app_data/downloads-incomplete";
|
||||
isReadOnly = false;
|
||||
};
|
||||
"${jackettDir}" = {
|
||||
hostPath = "/media/nas/ssd/nix-app-data/jackett";
|
||||
isReadOnly = false;
|
||||
};
|
||||
"/media/movies" = {
|
||||
hostPath = "/media/nas/main/movies";
|
||||
isReadOnly = false;
|
||||
};
|
||||
"/media/tv" = {
|
||||
hostPath = "/media/nas/main/tv";
|
||||
isReadOnly = false;
|
||||
};
|
||||
"/media/isos" = {
|
||||
hostPath = "/media/nas/main/isos";
|
||||
isReadOnly = false;
|
||||
firewall = {
|
||||
allowedTCPPorts = [ cfg.radarr.port cfg.sonarr.port cfg.sabnzbd.port cfg.deluge.port cfg.jackett.port ];
|
||||
allowedUDPPorts = [ cfg.radarr.port cfg.sonarr.port cfg.sabnzbd.port cfg.deluge.port cfg.jackett.port ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.nat = {
|
||||
forwardPorts = [
|
||||
{
|
||||
destination = "10.0.1.51:7878";
|
||||
sourcePort = radarrPort;
|
||||
}
|
||||
{
|
||||
destination = "10.0.1.51:8989";
|
||||
sourcePort = sonarrPort;
|
||||
}
|
||||
{
|
||||
destination = "10.0.1.51:8080";
|
||||
sourcePort = sabnzbdPort;
|
||||
}
|
||||
{
|
||||
destination = "10.0.1.51:8112";
|
||||
sourcePort = delugePort;
|
||||
}
|
||||
{
|
||||
destination = "10.0.1.51:9117";
|
||||
sourcePort = jackettPort;
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
112
hosts/nas/apps/arrs/options.nix
Normal file
112
hosts/nas/apps/arrs/options.nix
Normal file
@@ -0,0 +1,112 @@
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.nas-apps.arrs = {
|
||||
enable = mkEnableOption "arrs services";
|
||||
|
||||
radarr = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 7878;
|
||||
};
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
sonarr = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 8989;
|
||||
};
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
sabnzbd = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 8280;
|
||||
};
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
deluge = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 8112;
|
||||
};
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
jackett = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 9117;
|
||||
};
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
localAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
};
|
||||
|
||||
downloadsDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
incompleteDownloadsDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
moviesDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
tvDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
isosDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,44 +1,58 @@
|
||||
{ outputs, pkgs, ... }:
|
||||
{ outputs, config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.nas-apps.crowdsec;
|
||||
in
|
||||
{
|
||||
services = {
|
||||
crowdsec = let
|
||||
yaml = (pkgs.formats.yaml {}).generate;
|
||||
acquisitions_file = yaml "acquisitions.yaml" {
|
||||
source = "journalctl";
|
||||
journalctl_filter = ["_SYSTEMD_UNIT=sshd.service"];
|
||||
labels.type = "syslog";
|
||||
imports = [ ./options.nix ];
|
||||
config = lib.mkIf cfg.enable {
|
||||
services = {
|
||||
crowdsec = let
|
||||
yaml = (pkgs.formats.yaml {}).generate;
|
||||
acquisitions_file = yaml "acquisitions.yaml" {
|
||||
source = "journalctl";
|
||||
journalctl_filter = ["_SYSTEMD_UNIT=sshd.service"];
|
||||
labels.type = "syslog";
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
enrollKeyFile = "${cfg.dataDir}/enroll.key";
|
||||
settings = {
|
||||
crowdsec_service.acquisition_path = acquisitions_file;
|
||||
api.server = {
|
||||
listen_uri = "0.0.0.0:${toString cfg.port}";
|
||||
};
|
||||
};
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
enrollKeyFile = "/media/nas/ssd/nix-app-data/crowdsec/enroll.key";
|
||||
settings = {
|
||||
crowdsec_service.acquisition_path = acquisitions_file;
|
||||
api.server = {
|
||||
listen_uri = "0.0.0.0:9898";
|
||||
|
||||
crowdsec-firewall-bouncer = {
|
||||
enable = true;
|
||||
settings = {
|
||||
api_key = cfg.apiKey;
|
||||
api_url = "http://${cfg.apiAddress}:${toString cfg.port}";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
crowdsec-firewall-bouncer = {
|
||||
enable = true;
|
||||
settings = {
|
||||
api_key = "1daH89qmJ41r2Lpd9hvDw4sxtOAtBzaj3aKFOFqE";
|
||||
api_url = "http://10.0.1.18:9898";
|
||||
systemd.services.crowdsec.serviceConfig = {
|
||||
ExecStartPre = let
|
||||
script = pkgs.writeScriptBin "register-bouncer" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if ! cscli bouncers list | grep -q "nas-bouncer"; then
|
||||
cscli bouncers add "nas-bouncer" --key "${cfg.apiKey}"
|
||||
fi
|
||||
'';
|
||||
in ["${script}/bin/register-bouncer"];
|
||||
};
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
allowedTCPPorts = [ cfg.port ];
|
||||
allowedUDPPorts = [ cfg.port ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
systemd.services.crowdsec.serviceConfig = {
|
||||
ExecStartPre = let
|
||||
script = pkgs.writeScriptBin "register-bouncer" ''
|
||||
#!${pkgs.runtimeShell}
|
||||
set -eu
|
||||
set -o pipefail
|
||||
|
||||
if ! cscli bouncers list | grep -q "nas-bouncer"; then
|
||||
cscli bouncers add "nas-bouncer" --key "1daH89qmJ41r2Lpd9hvDw4sxtOAtBzaj3aKFOFqE"
|
||||
fi
|
||||
'';
|
||||
in ["${script}/bin/register-bouncer"];
|
||||
};
|
||||
}
|
||||
27
hosts/nas/apps/crowdsec/options.nix
Normal file
27
hosts/nas/apps/crowdsec/options.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.nas-apps.crowdsec = {
|
||||
enable = mkEnableOption "crowdsec service";
|
||||
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 9898;
|
||||
};
|
||||
|
||||
apiAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
};
|
||||
|
||||
apiKey = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,109 +1,130 @@
|
||||
{ config, ... }:
|
||||
{ config, lib, ... }:
|
||||
with lib;
|
||||
let
|
||||
cfg = config.nas-apps.gitea;
|
||||
hostAddress = "10.0.1.18";
|
||||
localAddress = "10.0.4.18";
|
||||
httpPort = 3000;
|
||||
sshPort = 2222;
|
||||
# localAddress = "10.0.4.18";
|
||||
# httpPort = 3000;
|
||||
# sshPort = 2222;
|
||||
rootUrl = "https://gitea.mjallen.dev/";
|
||||
stateDir = "/media/nas/ssd/nix-app-data/gitea";
|
||||
# stateDir = "/media/nas/ssd/nix-app-data/gitea";
|
||||
dataDir = "/var/lib/gitea";
|
||||
secretsDir = "/run/secrets/jallen-nas/gitea";
|
||||
mailerPasswordFile = config.sops.secrets."jallen-nas/gitea/mail-key".path;
|
||||
metricsTokenFile = config.sops.secrets."jallen-nas/gitea/metrics-key".path;
|
||||
in
|
||||
{
|
||||
containers.gitea = {
|
||||
autoStart = true;
|
||||
privateNetwork = true;
|
||||
hostAddress = hostAddress;
|
||||
localAddress = localAddress;
|
||||
imports = [ ./options.nix ];
|
||||
config = mkIf cfg.enable {
|
||||
containers.gitea = {
|
||||
autoStart = true;
|
||||
privateNetwork = true;
|
||||
hostAddress = hostAddress;
|
||||
localAddress = cfg.localAddress;
|
||||
|
||||
bindMounts = {
|
||||
${dataDir} = {
|
||||
hostPath = stateDir;
|
||||
isReadOnly = false;
|
||||
bindMounts = {
|
||||
${dataDir} = {
|
||||
hostPath = cfg.dataDir;
|
||||
isReadOnly = false;
|
||||
};
|
||||
secrets = {
|
||||
hostPath = secretsDir;
|
||||
isReadOnly = true;
|
||||
mountPoint = secretsDir;
|
||||
};
|
||||
};
|
||||
secrets = {
|
||||
hostPath = secretsDir;
|
||||
isReadOnly = true;
|
||||
mountPoint = secretsDir;
|
||||
|
||||
config = { lib, ... }:
|
||||
{
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
stateDir = dataDir;
|
||||
mailerPasswordFile = mailerPasswordFile;
|
||||
metricsTokenFile = metricsTokenFile;
|
||||
settings = {
|
||||
server = {
|
||||
DOMAIN = "jallen-nas";
|
||||
HTTP_ADDR = "0.0.0.0";
|
||||
HTTP_PORT = cfg.httpPort;
|
||||
PROTOCOL = "http";
|
||||
ROOT_URL = rootUrl;
|
||||
START_SSH_SERVER = true;
|
||||
SSH_PORT = cfg.sshPort;
|
||||
};
|
||||
service = {
|
||||
REGISTER_EMAIL_CONFIRM = false;
|
||||
ENABLE_CAPTCHA = false;
|
||||
DISABLE_REGISTRATION = true;
|
||||
ENABLE_OPENID_SIGNIN = false;
|
||||
ENABLE_LDAP_SIGNIN = false;
|
||||
ENABLE_SSH_SIGNIN = true;
|
||||
ENABLE_BUILTIN_SSH_SERVER = true;
|
||||
ENABLE_REVERSE_PROXY_AUTHENTICATION = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
users.users.gitea = {
|
||||
extraGroups = [ "keys" ];
|
||||
};
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ cfg.httpPort cfg.sshPort ];
|
||||
};
|
||||
# Use systemd-resolved inside the container
|
||||
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
|
||||
useHostResolvConf = lib.mkForce false;
|
||||
};
|
||||
|
||||
# Create and set permissions for required directories
|
||||
system.activationScripts.gitea-dirs = ''
|
||||
mkdir -p /var/lib/gitea
|
||||
chown -R gitea:gitea /var/lib/gitea
|
||||
chmod -R 775 /var/lib/gitea
|
||||
mkdir -p /run/secrets/jallen-nas
|
||||
chown -R gitea:gitea /run/secrets/jallen-nas
|
||||
chmod -R 775 /run/secrets/jallen-nas
|
||||
'';
|
||||
|
||||
services.resolved.enable = true;
|
||||
system.stateVersion = "23.11";
|
||||
};
|
||||
};
|
||||
|
||||
services.traefik.dynamicConfigOptions = lib.mkIf cfg.reverseProxy.enable {
|
||||
services.gitea.loadBalancer.servers = [
|
||||
{
|
||||
url = "http://${cfg.localAddress}:${toString cfg.httpPort}";
|
||||
}
|
||||
];
|
||||
routers.gitea = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`${cfg.reverseProxy.host}`)";
|
||||
service = "gitea";
|
||||
middlewares = cfg.reverseProxy.middlewares;
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
};
|
||||
|
||||
config = { lib, ... }:
|
||||
{
|
||||
services.gitea = {
|
||||
enable = true;
|
||||
stateDir = dataDir;
|
||||
useWizard = false;
|
||||
mailerPasswordFile = mailerPasswordFile;
|
||||
metricsTokenFile = metricsTokenFile;
|
||||
settings = {
|
||||
server = {
|
||||
DOMAIN = "jallen-nas";
|
||||
HTTP_ADDR = "0.0.0.0";
|
||||
HTTP_PORT = httpPort;
|
||||
PROTOCOL = "http";
|
||||
ROOT_URL = rootUrl;
|
||||
START_SSH_SERVER = true;
|
||||
SSH_PORT = sshPort;
|
||||
};
|
||||
service = {
|
||||
REGISTER_EMAIL_CONFIRM = false;
|
||||
ENABLE_CAPTCHA = false;
|
||||
DISABLE_REGISTRATION = true;
|
||||
ENABLE_OPENID_SIGNIN = false;
|
||||
ENABLE_LDAP_SIGNIN = false;
|
||||
ENABLE_SSH_SIGNIN = true;
|
||||
ENABLE_BUILTIN_SSH_SERVER = true;
|
||||
ENABLE_REVERSE_PROXY_AUTHENTICATION = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
users.users.gitea = {
|
||||
extraGroups = [ "keys" ];
|
||||
};
|
||||
|
||||
networking = {
|
||||
firewall = {
|
||||
enable = true;
|
||||
allowedTCPPorts = [ httpPort sshPort 22 ];
|
||||
};
|
||||
# Use systemd-resolved inside the container
|
||||
# Workaround for bug https://github.com/NixOS/nixpkgs/issues/162686
|
||||
useHostResolvConf = lib.mkForce false;
|
||||
};
|
||||
|
||||
# Create and set permissions for required directories
|
||||
system.activationScripts.gitea-dirs = ''
|
||||
mkdir -p /var/lib/gitea
|
||||
chown -R gitea:gitea /var/lib/gitea
|
||||
chmod -R 775 /var/lib/gitea
|
||||
mkdir -p /run/secrets/jallen-nas
|
||||
chown -R gitea:gitea /run/secrets/jallen-nas
|
||||
chmod -R 775 /run/secrets/jallen-nas
|
||||
'';
|
||||
|
||||
services.resolved.enable = true;
|
||||
system.stateVersion = "23.11";
|
||||
networking = {
|
||||
nat = {
|
||||
forwardPorts = [
|
||||
{
|
||||
destination = "${cfg.localAddress}:${toString cfg.httpPort}";
|
||||
sourcePort = cfg.httpPort;
|
||||
}
|
||||
{
|
||||
destination = "${cfg.localAddress}:${toString cfg.sshPort}";
|
||||
sourcePort = cfg.sshPort;
|
||||
}
|
||||
];
|
||||
};
|
||||
firewall = {
|
||||
allowedTCPPorts = [ cfg.httpPort cfg.sshPort ];
|
||||
allowedUDPPorts = [ cfg.httpPort cfg.sshPort ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.nat = {
|
||||
forwardPorts = [
|
||||
{
|
||||
destination = "${localAddress}:${toString httpPort}";
|
||||
sourcePort = httpPort;
|
||||
}
|
||||
{
|
||||
destination = "${localAddress}:${toString 2222}";
|
||||
sourcePort = sshPort;
|
||||
}
|
||||
# {
|
||||
# destination = "${localAddress}:${toString 22}";
|
||||
# sourcePort = 22;
|
||||
# }
|
||||
];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
42
hosts/nas/apps/gitea/options.nix
Normal file
42
hosts/nas/apps/gitea/options.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{ lib, ... }:
|
||||
with lib;
|
||||
{
|
||||
options.nas-apps.gitea = {
|
||||
enable = mkEnableOption "gitea service";
|
||||
|
||||
httpPort = mkOption {
|
||||
type = types.int;
|
||||
default = 80;
|
||||
};
|
||||
|
||||
sshPort = mkOption {
|
||||
type = types.int;
|
||||
default = 22;
|
||||
};
|
||||
|
||||
localAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
reverseProxy = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
middlewares = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
46
hosts/nas/apps/options.nix
Normal file
46
hosts/nas/apps/options.nix
Normal file
@@ -0,0 +1,46 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib) types mkOption;
|
||||
in
|
||||
{
|
||||
options.nas-apps = mkOption {
|
||||
type = types.attrsOf (types.submodule ({ config, name, ... }: {
|
||||
options = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
default = 80;
|
||||
};
|
||||
|
||||
localAddress = mkOption {
|
||||
type = types.str;
|
||||
default = "127.0.0.1";
|
||||
};
|
||||
|
||||
dataDir = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
|
||||
reverseProxy = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
host = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
middlewares = mkOption {
|
||||
type = with types; listOf str;
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}));
|
||||
};
|
||||
}
|
||||
@@ -1,25 +1,24 @@
|
||||
{ config, ... }:
|
||||
let
|
||||
domain = "mjallen.dev";
|
||||
serverIp = "10.0.1.18";
|
||||
|
||||
# Forward services
|
||||
authUrl = "http://10.0.1.18:9000/outpost.goauthentik.io";
|
||||
authentikUrl = "http://10.0.1.18:9000";
|
||||
onlyofficeUrl = "http://10.0.2.18:9980";
|
||||
cloudUrl = "http://10.0.2.18:80";
|
||||
jellyfinUrl = "http://10.0.1.18:8096";
|
||||
jellyseerrUrl = "http://10.0.1.52:5055";
|
||||
hassUrl = "http://homeassistant.local:8123";
|
||||
openWebUIUrl = "http://10.0.1.18:8888";
|
||||
paperlessUrl = "http://10.0.1.20:28981";
|
||||
cacheUrl = "http://10.0.1.18:5000";
|
||||
giteaUrl = "http://10.0.4.18:3000";
|
||||
actualUrl = "http://10.0.3.18:3333";
|
||||
lubeloggerUrl = "http://10.0.1.18:6754";
|
||||
immichUrl = "http://10.0.1.18:2283";
|
||||
authUrl = "http://${serverIp}:9000/outpost.goauthentik.io";
|
||||
|
||||
# internal services
|
||||
codeUrl = "http://10.0.1.18:4444";
|
||||
actualUrl = "http://${config.containers.actual.localAddress}:${toString config.containers.actual.config.services.actual.settings.port}";
|
||||
authentikUrl = "http://${serverIp}:9000";
|
||||
cacheUrl = "http://${serverIp}:${toString config.services.nix-serve.port}";
|
||||
cloudUrl = "http://${config.containers.nextcloud.localAddress}:80";
|
||||
giteaUrl = "http://${config.containers.gitea.localAddress}:${toString config.containers.gitea.config.services.gitea.settings.server.SSH_PORT}";
|
||||
hassUrl = "http://homeassistant.local:8123";
|
||||
immichUrl = "http://${serverIp}:${toString config.services.immich.port}";
|
||||
jellyfinUrl = "http://${serverIp}:8096";
|
||||
jellyseerrUrl = "http://${config.containers.jellyseerr.localAddress}:${toString config.containers.jellyseerr.config.services.jellyseerr.port}";
|
||||
lubeloggerUrl = "http://${serverIp}:6754";
|
||||
onlyofficeUrl = "http://${config.containers.nextcloud.localAddress}:${toString config.containers.nextcloud.config.services.onlyoffice.port}";
|
||||
openWebUIUrl = "http://${serverIp}:8888";
|
||||
paperlessUrl = "http://${config.containers.paperless.localAddress}:${toString config.containers.paperless.config.services.paperless.port}";
|
||||
|
||||
# Plugins
|
||||
traefikPlugins = {
|
||||
@@ -33,7 +32,7 @@ let
|
||||
};
|
||||
};
|
||||
|
||||
crowdsecAppsecHost = "10.0.1.18:7422";
|
||||
crowdsecAppsecHost = "${serverIp}:7422";
|
||||
crowdsecLapiKeyFile = config.sops.secrets."jallen-nas/traefik/crowdsec-lapi-key".path;
|
||||
|
||||
# Ports
|
||||
@@ -52,8 +51,7 @@ let
|
||||
# misc
|
||||
letsEncryptEmail = "jalle008@proton.me";
|
||||
dataDir = "/media/nas/ssd/nix-app-data/traefik";
|
||||
authentikAddress = "http://10.0.1.18:9000/outpost.goauthentik.io/auth/traefik";
|
||||
group = [ config.users.users.nix-apps.group.name ];
|
||||
authentikAddress = "http://${serverIp}:9000/outpost.goauthentik.io/auth/traefik";
|
||||
in
|
||||
{
|
||||
sops = {
|
||||
@@ -228,14 +226,25 @@ in
|
||||
url = authUrl;
|
||||
}
|
||||
];
|
||||
|
||||
actual.loadBalancer.servers = [
|
||||
{
|
||||
url = actualUrl;
|
||||
}
|
||||
];
|
||||
authentik.loadBalancer.servers = [
|
||||
{
|
||||
url = authentikUrl;
|
||||
}
|
||||
];
|
||||
onlyoffice.loadBalancer.servers = [
|
||||
cache.loadBalancer.servers = [
|
||||
{
|
||||
url = onlyofficeUrl;
|
||||
url = cacheUrl;
|
||||
}
|
||||
];
|
||||
chat.loadBalancer.servers = [
|
||||
{
|
||||
url = openWebUIUrl;
|
||||
}
|
||||
];
|
||||
cloud.loadBalancer.servers = [
|
||||
@@ -243,6 +252,21 @@ in
|
||||
url = cloudUrl;
|
||||
}
|
||||
];
|
||||
gitea.loadBalancer.servers = [
|
||||
{
|
||||
url = giteaUrl;
|
||||
}
|
||||
];
|
||||
hass.loadBalancer.servers = [
|
||||
{
|
||||
url = hassUrl;
|
||||
}
|
||||
];
|
||||
immich.loadBalancer.servers = [
|
||||
{
|
||||
url = immichUrl;
|
||||
}
|
||||
];
|
||||
jellyfin.loadBalancer.servers = [
|
||||
{
|
||||
url = jellyfinUrl;
|
||||
@@ -253,51 +277,19 @@ in
|
||||
url = jellyseerrUrl;
|
||||
}
|
||||
];
|
||||
hass.loadBalancer.servers = [
|
||||
{
|
||||
url = hassUrl;
|
||||
}
|
||||
];
|
||||
chat.loadBalancer.servers = [
|
||||
{
|
||||
url = openWebUIUrl;
|
||||
}
|
||||
];
|
||||
cache.loadBalancer.servers = [
|
||||
{
|
||||
url = cacheUrl;
|
||||
}
|
||||
];
|
||||
paperless.loadBalancer.servers = [
|
||||
{
|
||||
url = paperlessUrl;
|
||||
}
|
||||
];
|
||||
gitea.loadBalancer.servers = [
|
||||
{
|
||||
url = giteaUrl;
|
||||
}
|
||||
];
|
||||
actual.loadBalancer.servers = [
|
||||
{
|
||||
url = actualUrl;
|
||||
}
|
||||
];
|
||||
lubelogger.loadBalancer.servers = [
|
||||
{
|
||||
url = lubeloggerUrl;
|
||||
}
|
||||
];
|
||||
immich.loadBalancer.servers = [
|
||||
onlyoffice.loadBalancer.servers = [
|
||||
{
|
||||
url = immichUrl;
|
||||
url = onlyofficeUrl;
|
||||
}
|
||||
];
|
||||
|
||||
# internal services
|
||||
code.loadBalancer.servers = [
|
||||
paperless.loadBalancer.servers = [
|
||||
{
|
||||
url = codeUrl;
|
||||
url = paperlessUrl;
|
||||
}
|
||||
];
|
||||
};
|
||||
@@ -311,6 +303,14 @@ in
|
||||
priority = 15;
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
|
||||
actual = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`actual.${domain}`)";
|
||||
service = "actual";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
authentik = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`authentik.${domain}`)";
|
||||
@@ -318,11 +318,12 @@ in
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
onlyoffice = {
|
||||
cache = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`office.${domain}`)";
|
||||
service = "onlyoffice";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" "onlyoffice-websocket" ];
|
||||
rule = "Host(`cache.${domain}`)";
|
||||
service = "cache";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
priority = 10;
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
cloud = {
|
||||
@@ -332,6 +333,28 @@ in
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
gitea = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`gitea.${domain}`)";
|
||||
service = "gitea";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
hass = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`hass.${domain}`)";
|
||||
service = "hass";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" "authentik" ];
|
||||
priority = 10;
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
immich = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`immich.${domain}`)";
|
||||
service = "immich";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
jellyfin = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`jellyfin.${domain}`)";
|
||||
@@ -346,36 +369,6 @@ in
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
gitea = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`gitea.${domain}`)";
|
||||
service = "gitea";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
actual = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`actual.${domain}`)";
|
||||
service = "actual";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
hass = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`hass.${domain}`)";
|
||||
service = "hass";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" "authentik" ];
|
||||
priority = 10;
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
cache = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`cache.${domain}`)";
|
||||
service = "cache";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
priority = 10;
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
lubelogger = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`lubelogger.${domain}`)";
|
||||
@@ -383,20 +376,11 @@ in
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
immich = {
|
||||
onlyoffice = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`immich.${domain}`)";
|
||||
service = "immich";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
|
||||
# internal services
|
||||
code = {
|
||||
entryPoints = [ "websecure" ];
|
||||
rule = "Host(`code.${domain}`)";
|
||||
service = "code";
|
||||
middlewares = [ "internal-ipallowlist" ];
|
||||
rule = "Host(`office.${domain}`)";
|
||||
service = "onlyoffice";
|
||||
middlewares = [ "crowdsec" "whitelist-geoblock" "onlyoffice-websocket" ];
|
||||
tls.certResolver = "letsencrypt";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
'';
|
||||
|
||||
systemPackages = with pkgs; [
|
||||
attic-client
|
||||
binutils
|
||||
cryptsetup
|
||||
cmake
|
||||
|
||||
@@ -22,7 +22,7 @@ in
|
||||
];
|
||||
};
|
||||
libvirt = {
|
||||
enable = true;
|
||||
enable = false;
|
||||
openFirewall = true;
|
||||
};
|
||||
nut = {
|
||||
|
||||
@@ -21,6 +21,7 @@ let
|
||||
6754 # lubelogger
|
||||
2283 # immich
|
||||
4444 # code-server
|
||||
9012
|
||||
];
|
||||
in
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{ pkgs, ... }:
|
||||
{ config, pkgs, ... }:
|
||||
let
|
||||
nix-build-mail = pkgs.writeShellScript "echo -e \"Content-Type: text/plain\\r\\nSubject: NixOS cache rebuild failed\\r\\n\\r\\nThe nix-rebuild-cache service failed at $(date).\" | sendmail jalle008@proton.me";
|
||||
in
|
||||
@@ -13,6 +13,14 @@ in
|
||||
openFirewall = true;
|
||||
};
|
||||
|
||||
services.atticd = {
|
||||
enable = true;
|
||||
environmentFile = config.sops.secrets."jallen-nas/attic-key".path;
|
||||
settings = {
|
||||
listen = "[::]:9012";
|
||||
};
|
||||
};
|
||||
|
||||
# Improved systemd service with better error handling
|
||||
systemd = {
|
||||
services = {
|
||||
@@ -299,8 +307,8 @@ in
|
||||
};
|
||||
};
|
||||
|
||||
# nix.settings.builders-use-substitutes = true;
|
||||
# nix.distributedBuilds = true;
|
||||
nix.settings.builders-use-substitutes = true;
|
||||
nix.distributedBuilds = true;
|
||||
nix.buildMachines = [
|
||||
{
|
||||
hostName = "pi5.local";
|
||||
|
||||
@@ -233,6 +233,9 @@ in
|
||||
path = "/etc/secureboot/keys/PK/PK.pem";
|
||||
mode = "0640";
|
||||
};
|
||||
"jallen-nas/attic-key" = {
|
||||
# owner = "atticd";
|
||||
};
|
||||
};
|
||||
|
||||
# ------------------------------
|
||||
|
||||
Reference in New Issue
Block a user