mirror of
https://github.com/materusPL/nixos-config
synced 2026-07-02 12:46:42 +00:00
waffentrager: add maloja and multi-scrobbler, file restructure. valkyrie: reverse proxy
This commit is contained in:
@@ -2,16 +2,17 @@
|
||||
{
|
||||
imports =
|
||||
[
|
||||
./elements.nix
|
||||
./postgresql.nix
|
||||
./mount-acme.nix
|
||||
./gitea.nix
|
||||
./nginx.nix
|
||||
./nextcloud.nix
|
||||
./samba.nix
|
||||
./syncthing.nix
|
||||
./jellyfin.nix
|
||||
./storage/elements.nix
|
||||
./storage/mount-acme.nix
|
||||
./storage/gitea.nix
|
||||
./storage/nextcloud.nix
|
||||
./storage/samba.nix
|
||||
./storage/syncthing.nix
|
||||
./multimedia/jellyfin.nix
|
||||
./multimedia/scrobbling.nix
|
||||
./monitoring.nix
|
||||
./nginx.nix
|
||||
./postgresql.nix
|
||||
./auth
|
||||
];
|
||||
waffentragerService.elements.enable = true;
|
||||
@@ -22,6 +23,8 @@
|
||||
waffentragerService.nextcloud.enable = true;
|
||||
waffentragerService.samba.enable = true;
|
||||
waffentragerService.jellyfin.enable = true;
|
||||
waffentragerService.scrobbling.enable = true;
|
||||
|
||||
waffentragerService.syncthing.enable = true;
|
||||
waffentragerService.monitoring.enable = true;
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
{ config, pkgs, lib, materusArg, ... }:
|
||||
{
|
||||
options.waffentragerService.scrobbling.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable scrobbling";
|
||||
|
||||
|
||||
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.waffentragerService.scrobbling;
|
||||
in
|
||||
|
||||
|
||||
#### MALOJA
|
||||
lib.mkIf cfg.enable {
|
||||
sops.templates."maloja.env".content = ''
|
||||
MALOJA_DATA_DIRECTORY=/data
|
||||
MALOJA_DIRECTORY_CONFIG=/data/config
|
||||
MALOJA_DIRECTORY_STATE=/data/state
|
||||
MALOJA_DIRECTORY_CACHE=/data/cache
|
||||
MALOJA_NAME="Melody"
|
||||
MALOJA_LASTFM_USERNAME=${config.sops.placeholder.lastfm-user}
|
||||
MALOJA_LASTFM_PASSWORD=${config.sops.placeholder.lastfm-pass}
|
||||
MALOJA_LASTFM_API_KEY=${config.sops.placeholder.lastfm-api}
|
||||
MALOJA_LASTFM_API_SECRET=${config.sops.placeholder.lastfm-secret}
|
||||
MALOJA_LASTFM_API_SK=${config.sops.placeholder.lastfm-token}
|
||||
MALOJA_SKIP_SETUP=yes
|
||||
MALOJA_FORCE_PASSWORD=${config.sops.placeholder.maloja}
|
||||
MALOJA_SPOTIFY_API_ID=${config.sops.placeholder.spotify-client-id}
|
||||
MALOJA_SPOTIFY_API_SECRET=${config.sops.placeholder.spotify-client-secret}
|
||||
'';
|
||||
|
||||
virtualisation.oci-containers.containers.maloja = {
|
||||
image = "krateng/maloja:latest";
|
||||
ports = [
|
||||
"42010:42010"
|
||||
];
|
||||
volumes = [
|
||||
"${config.waffentragerService.elements.malojaDir}:/data"
|
||||
];
|
||||
environmentFiles = [
|
||||
config.sops.templates."maloja.env".path
|
||||
];
|
||||
};
|
||||
systemd.services."${config.virtualisation.oci-containers.backend}-maloja" = {
|
||||
requires = [ "elements-mount.service" ];
|
||||
after = [ "elements-mount.service" ];
|
||||
};
|
||||
|
||||
#### MULTI SCROBBLER
|
||||
sops.templates."multi-scrobbler.env".content = ''
|
||||
BASE_URL="https://melody.materus.pl/multi-scrobbler"
|
||||
TC=Europe/Warsaw
|
||||
|
||||
JELLYFIN_SERVER="https://noot.materus.pl/"
|
||||
SPOTIFY_CLIENT_ID=${config.sops.placeholder.spotify-client-id}
|
||||
SPOTIFY_CLIENT_SECRET=${config.sops.placeholder.spotify-client-secret}
|
||||
MALOJA_URL="https://melody.materus.pl"
|
||||
MALOJA_API_KEY="${config.sops.placeholder.maloja-api}"
|
||||
LASTFM_API_KEY=${config.sops.placeholder.lastfm-api}
|
||||
LASTFM_SECRET=${config.sops.placeholder.lastfm-secret}
|
||||
'';
|
||||
virtualisation.oci-containers.containers.multi-scrobbler = {
|
||||
image = "foxxmd/multi-scrobbler:latest";
|
||||
ports = [
|
||||
"42011:9078"
|
||||
];
|
||||
volumes = [
|
||||
"${config.waffentragerService.elements.malojaDir}/multi-scrobbler:/data"
|
||||
];
|
||||
environmentFiles = [
|
||||
config.sops.templates."multi-scrobbler.env".path
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
|
||||
#### Proxy
|
||||
services.nginx.virtualHosts = {
|
||||
"melody.materus.pl" = {
|
||||
sslTrustedCertificate = "/var/lib/mnt_acme/materus.pl/chain.pem";
|
||||
sslCertificateKey = "/var/lib/mnt_acme/materus.pl/key.pem";
|
||||
sslCertificate = "/var/lib/mnt_acme/materus.pl/fullchain.pem";
|
||||
addSSL = true;
|
||||
http2 = false;
|
||||
http3 = true;
|
||||
# Maloja
|
||||
locations."/" = {
|
||||
proxyPass = "http://127.0.0.1:42010";
|
||||
extraConfig = ''
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Ssl on;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
'';
|
||||
};
|
||||
|
||||
locations."/multi-scrobbler" = {
|
||||
proxyPass = "http://127.0.0.1:42011";
|
||||
extraConfig = ''
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-Ssl on;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
+6
@@ -7,6 +7,8 @@
|
||||
options.waffentragerService.elements.nextcloudDir = lib.mkOption { default = "${config.waffentragerService.elements.path}/services/nextcloud"; };
|
||||
options.waffentragerService.elements.lldapDir = lib.mkOption { default = "${config.waffentragerService.elements.path}/services/lldap"; };
|
||||
options.waffentragerService.elements.jellyfinDir = lib.mkOption { default = "${config.waffentragerService.elements.path}/services/jellyfin"; };
|
||||
options.waffentragerService.elements.malojaDir = lib.mkOption { default = "${config.waffentragerService.elements.path}/services/maloja"; };
|
||||
|
||||
config =
|
||||
let
|
||||
cfg = config.waffentragerService.elements;
|
||||
@@ -35,8 +37,12 @@
|
||||
'' + lib.optionalString config.waffentragerService.jellyfin.enable ''
|
||||
mkdir -p ${cfg.jellyfinDir}
|
||||
chown -R materus:nextcloud ${cfg.jellyfinDir}
|
||||
'' + lib.optionalString config.waffentragerService.scrobbling.enable ''
|
||||
mkdir -p ${cfg.malojaDir}/multi-scrobbler
|
||||
chown -R ${cfg.malojaDir}
|
||||
''
|
||||
|
||||
|
||||
;
|
||||
preStop = ''
|
||||
umount ${cfg.path}
|
||||
Reference in New Issue
Block a user