moved over a load more modules
This commit is contained in:
parent
21f6f37911
commit
30501b7fac
34 changed files with 226 additions and 578 deletions
|
@ -1,12 +1,28 @@
|
|||
{ lib, namespace, config, ... }:
|
||||
{ pkgs, lib, namespace, config, ... }:
|
||||
let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
inherit (lib) mkIf mkEnableOption mkOption;
|
||||
inherit (lib.types) str;
|
||||
|
||||
cfg = config.${namespace}.services.media;
|
||||
in
|
||||
{
|
||||
config.${namespace}.services.media = {
|
||||
options.${namespace}.services.media = {
|
||||
enable = mkEnableOption "Enable media services";
|
||||
|
||||
user = mkOption {
|
||||
type = str;
|
||||
default = "media";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = str;
|
||||
default = "media";
|
||||
};
|
||||
|
||||
path = mkOption {
|
||||
type = str;
|
||||
default = "/var/media";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
@ -23,7 +39,7 @@ in
|
|||
id3v2
|
||||
yt-dlp
|
||||
];
|
||||
|
||||
|
||||
# need to permit these outdated packages until servarr finally upgrades at some point...
|
||||
permittedInsecurePackages = [
|
||||
"dotnet-sdk-6.0.428"
|
||||
|
@ -34,22 +50,22 @@ in
|
|||
# Prepare system
|
||||
#=========================================================================
|
||||
users = {
|
||||
users.${user} = {
|
||||
users.${cfg.user} = {
|
||||
isSystemUser = true;
|
||||
group = group;
|
||||
group = cfg.group;
|
||||
};
|
||||
groups.${group} = {};
|
||||
groups.${cfg.group} = {};
|
||||
};
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d '${directory}/series' 0700 ${user} ${group} - -"
|
||||
"d '${directory}/movies' 0700 ${user} ${group} - -"
|
||||
"d '${directory}/music' 0700 ${user} ${group} - -"
|
||||
"d '${directory}/qbittorrent' 0700 ${user} ${group} - -"
|
||||
"d '${directory}/sabnzbd' 0700 ${user} ${group} - -"
|
||||
"d '${directory}/reiverr/config' 0700 ${user} ${group} - -"
|
||||
"d '${directory}/downloads/incomplete' 0700 ${user} ${group} - -"
|
||||
"d '${directory}/downloads/done' 0700 ${user} ${group} - -"
|
||||
"d '${cfg.directory}/series' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
"d '${cfg.directory}/movies' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
"d '${cfg.directory}/music' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
"d '${cfg.directory}/qbittorrent' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
"d '${cfg.directory}/sabnzbd' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
"d '${cfg.directory}/reiverr/config' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
"d '${cfg.directory}/downloads/incomplete' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
"d '${cfg.directory}/downloads/done' 0700 ${cfg.user} ${cfg.group} - -"
|
||||
];
|
||||
|
||||
#=========================================================================
|
||||
|
@ -59,8 +75,8 @@ in
|
|||
serviceConf = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
user = user;
|
||||
group = group;
|
||||
user = cfg.user;
|
||||
group = cfg.group;
|
||||
};
|
||||
in {
|
||||
jellyfin = serviceConf;
|
||||
|
@ -69,11 +85,6 @@ in
|
|||
bazarr = serviceConf;
|
||||
lidarr = serviceConf;
|
||||
|
||||
lanraragi = {
|
||||
enable = true;
|
||||
port = 6969;
|
||||
};
|
||||
|
||||
jellyseerr = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
|
@ -87,20 +98,34 @@ in
|
|||
qbittorrent = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
dataDir = "${directory}/qbittorrent";
|
||||
dataDir = "${cfg.directory}/qbittorrent";
|
||||
port = 5000;
|
||||
|
||||
user = user;
|
||||
group = group;
|
||||
user = cfg.user;
|
||||
group = cfg.group;
|
||||
};
|
||||
|
||||
sabnzbd = {
|
||||
enable = true;
|
||||
openFirewall = true;
|
||||
configFile = "${directory}/sabnzbd/config.ini";
|
||||
configFile = "${cfg.directory}/sabnzbd/config.ini";
|
||||
|
||||
user = user;
|
||||
group = group;
|
||||
user = cfg.user;
|
||||
group = cfg.group;
|
||||
};
|
||||
|
||||
caddy = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
"media.kruining.eu".extraConfig = ''
|
||||
import auth
|
||||
|
||||
reverse_proxy http://127.0.0.1:9494
|
||||
'';
|
||||
"jellyfin.kruining.eu".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:8096
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -123,31 +148,12 @@ in
|
|||
image = "ghcr.io/aleksilassila/reiverr:v2.2.0";
|
||||
autoStart = true;
|
||||
ports = [ "127.0.0.1:9494:9494" ];
|
||||
volumes = [ "${directory}/reiverr/config:/config" ];
|
||||
volumes = [ "${cfg.directory}/reiverr/config:/config" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#=========================================================================
|
||||
# Hosting
|
||||
#=========================================================================
|
||||
services = {
|
||||
caddy = {
|
||||
enable = true;
|
||||
virtualHosts = {
|
||||
"media.kruining.eu".extraConfig = ''
|
||||
import auth
|
||||
|
||||
reverse_proxy http://127.0.0.1:9494
|
||||
'';
|
||||
"jellyfin.kruining.eu".extraConfig = ''
|
||||
reverse_proxy http://127.0.0.1:8096
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
networking.firewall.allowedTCPPorts = [ 80 443 6969 ];
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
88
modules/nixos/services/media/nextcloud.nix
Normal file
88
modules/nixos/services/media/nextcloud.nix
Normal file
|
@ -0,0 +1,88 @@
|
|||
{ config, lib, pkgs, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf mkEnableOption mkOption;
|
||||
inherit (lib.types) str;
|
||||
|
||||
cfg = config.${namespace}.services.media.nextcloud;
|
||||
in
|
||||
{
|
||||
options.modules.services.nextcloud = {
|
||||
enable = mkEnableOption "Nextcloud";
|
||||
|
||||
user = mkOption {
|
||||
type = str;
|
||||
default = "nextcloud";
|
||||
};
|
||||
|
||||
group = mkOption {
|
||||
type = str;
|
||||
default = "nextcloud";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
users = {
|
||||
users.${cfg.user} = {
|
||||
isSystemUser = true;
|
||||
group = cfg.group;
|
||||
};
|
||||
groups.${cfg.group} = {};
|
||||
};
|
||||
|
||||
home-manager.users.${cfg.user}.home = {
|
||||
stateVersion = config.system.stateVersion;
|
||||
|
||||
file.".netrc".text = ''
|
||||
login root
|
||||
password KaasIsAwesome!
|
||||
'';
|
||||
};
|
||||
|
||||
services.nextcloud = {
|
||||
enable = true;
|
||||
webserver = "caddy";
|
||||
package = pkgs.nextcloud31;
|
||||
hostName = "localhost";
|
||||
|
||||
config = {
|
||||
adminpassFile = "/var/lib/nextcloud/admin-pass";
|
||||
dbtype = "sqlite";
|
||||
};
|
||||
};
|
||||
|
||||
# systemd.user = {
|
||||
# services.nextcloud-autosync = {
|
||||
# Unit = {
|
||||
# Description = "Automatic nextcloud sync";
|
||||
# After = "network-online.target";
|
||||
# };
|
||||
# WantedBy = [ "multi-user.target" ];
|
||||
# Service = {
|
||||
# Type = "simple";
|
||||
# ExecStart = "${pkgs.nextcloud-client}/bin/nextcloudcmd -h -n --path /var/media/music https://cloud.kruining.eu";
|
||||
# TimeoutStopSec = "180";
|
||||
# KillMode = "process";
|
||||
# KillSignal = "SIGINT";
|
||||
# };
|
||||
# };
|
||||
|
||||
# timers.nextcloud-autosync = {
|
||||
# Unit.Description = "Automatic nextcloud sync";
|
||||
# Timer.OnBootSec = "5min";
|
||||
# Timer.OnUnitActiveSec = "60min";
|
||||
# Install.WantedBy = [ "multi-user.target" "timers.target" ];
|
||||
# };
|
||||
|
||||
# startServices = true;
|
||||
# };
|
||||
|
||||
services.caddy = {
|
||||
enable = true;
|
||||
virtualHosts."cloud.kruining.eu".extraConfig = ''
|
||||
php_fastcgi unix//run/phpfpm/nextcloud.sock {
|
||||
env front_controller_active true
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
22
modules/nixos/services/media/nfs.nix
Normal file
22
modules/nixos/services/media/nfs.nix
Normal file
|
@ -0,0 +1,22 @@
|
|||
{ config, lib, namespace, ... }:
|
||||
let
|
||||
inherit (lib) mkIf mkEnableOption;
|
||||
|
||||
cfg = config.${namespace}.media.nfs;
|
||||
in
|
||||
{
|
||||
options.${namespace}.media.nfs = {
|
||||
enable = mkEnableOption "Enable NFS";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
networking.firewall.allowedTCPPorts = [ 2049 ];
|
||||
|
||||
services.nfs.server = {
|
||||
enable = true;
|
||||
exports = ''
|
||||
/var/media manwe(rw,fsid=0,no_subtree_check)
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue