diff --git a/hosts/glyph/secrets/audiomuse-env.age b/hosts/glyph/secrets/audiomuse-env.age new file mode 100644 index 00000000..275c351a --- /dev/null +++ b/hosts/glyph/secrets/audiomuse-env.age @@ -0,0 +1,7 @@ +age-encryption.org/v1 +-> ssh-ed25519 rSr+rA Xv5Z5uJ2taK1fC1adStPVMyhJDeynSwoe89k4Fo/Enw +zrKo7M7UJ3hdaKCMp7B8fImRA1VIVyv2zrBmqW2psS0 +-> ssh-ed25519 3EWhnQ 8BWG7aLna2EboJ63F2iISv/yRNWksn3bXiekgHFCSj4 +/VZUGmL+20q3+/HHgq8wUdgP6uhOvPoDhJkaJMiLuqQ +--- v69QvzRzgmi08DMSTg+f87/GqVrtSeppJiH7RptDVoE +ñôÏVÕ&ÀYäÆ3ö¡KÐz] õÁÖ5ÖÒ!Øa¥ \ No newline at end of file diff --git a/hosts/glyph/services/audiomuse.nix b/hosts/glyph/services/audiomuse.nix new file mode 100644 index 00000000..ac435c7d --- /dev/null +++ b/hosts/glyph/services/audiomuse.nix @@ -0,0 +1,67 @@ +{config, ...}: let + dataDir = "/var/lib/audiomuse"; +in { + age.secrets.audiomuse-env.file = ./../secrets/audiomuse-env.age; + + systemd.tmpfiles.rules = [ + "d ${dataDir} 0755 root root - -" + "d ${dataDir}/temp-flask 0755 root root - -" + "d ${dataDir}/plugins-flask 0755 root root - -" + "d ${dataDir}/temp-worker 0755 root root - -" + "d ${dataDir}/plugins-worker 0755 root root - -" + ]; + + virtualisation.oci-containers.containers = { + audiomuse-flask = { + image = "ghcr.io/neptunehub/audiomuse-ai:latest"; + environmentFiles = [config.age.secrets.audiomuse-env.path]; + environment = { + SERVICE_TYPE = "flask"; + TZ = config.time.timeZone; + POSTGRES_USER = "audiomuse"; + POSTGRES_DB = "audiomuse"; + POSTGRES_HOST = "127.0.0.1"; + POSTGRES_PORT = "5432"; + TEMP_DIR = "/app/temp_audio"; + }; + volumes = [ + "${dataDir}/temp-flask:/app/temp_audio" + "${dataDir}/plugins-flask:/app/plugin/installed" + ]; + extraOptions = ["--network=host"]; + }; + + audiomuse-worker = { + image = "ghcr.io/neptunehub/audiomuse-ai:latest"; + environmentFiles = [config.age.secrets.audiomuse-env.path]; + environment = { + SERVICE_TYPE = "worker"; + TZ = config.time.timeZone; + POSTGRES_USER = "audiomuse"; + POSTGRES_DB = "audiomuse"; + POSTGRES_HOST = "127.0.0.1"; + POSTGRES_PORT = "5432"; + TEMP_DIR = "/app/temp_audio"; + NUMBA_CACHE_DIR = "/app/temp_audio/.numba_cache"; + }; + volumes = [ + "${dataDir}/temp-worker:/app/temp_audio" + "${dataDir}/plugins-worker:/app/plugin/installed" + ]; + extraOptions = ["--network=host"]; + }; + }; + + systemd.services = { + "podman-audiomuse-flask" = { + after = ["postgresql.service"]; + requires = ["postgresql.service"]; + }; + "podman-audiomuse-worker" = { + after = ["postgresql.service"]; + requires = ["postgresql.service"]; + }; + }; + + networking.firewall.allowedTCPPorts = [8000]; +} diff --git a/hosts/glyph/services/db.nix b/hosts/glyph/services/db.nix index 5da67060..7e9626cf 100644 --- a/hosts/glyph/services/db.nix +++ b/hosts/glyph/services/db.nix @@ -12,7 +12,7 @@ port = 5432; max_connections = 150; }; - ensureDatabases = ["atticd" "grafana" "open-webui" "pocketid"]; + ensureDatabases = ["atticd" "audiomuse" "grafana" "open-webui" "pocketid"]; ensureUsers = [ { name = "mu"; @@ -22,6 +22,10 @@ name = "atticd"; ensureDBOwnership = true; } + { + name = "audiomuse"; + ensureDBOwnership = true; + } { name = "grafana"; ensureDBOwnership = true; @@ -39,6 +43,6 @@ services.postgresqlBackup = { enable = true; - databases = ["atticd" "grafana" "open-webui" "pocketid" "windmill"]; + databases = ["atticd" "audiomuse" "grafana" "open-webui" "pocketid" "windmill"]; }; } diff --git a/hosts/glyph/services/default.nix b/hosts/glyph/services/default.nix index db05bb11..2f7d3802 100644 --- a/hosts/glyph/services/default.nix +++ b/hosts/glyph/services/default.nix @@ -7,6 +7,7 @@ imports = [ ./alloy.nix ./attic.nix + ./audiomuse.nix ./db.nix ./avahi.nix ./dns.nix diff --git a/hosts/glyph/services/navidrome.nix b/hosts/glyph/services/navidrome.nix index 792f4450..77cf78a8 100644 --- a/hosts/glyph/services/navidrome.nix +++ b/hosts/glyph/services/navidrome.nix @@ -32,6 +32,7 @@ in { environmentFile = config.age.secrets.navidrome-env.path; plugins = [ pkgs.navidromePlugins.apple-music + pkgs.navidromePlugins.audiomuseai nd-lyrics ]; settings = { @@ -41,7 +42,7 @@ in { Scanner.Schedule = "@every 1h"; RecentlyAddedByModTime = true; Prometheus.Enabled = true; - Agents = "apple-music,lastfm,deezer"; + Agents = "apple-music,lastfm,deezer,audiomuseai"; LyricsPriority = ".ttml,.yaml,.yml,.elrc,.lrc,.srt,.txt,embedded,nd-lyrics"; }; }; diff --git a/hosts/glyph/services/open-terminal.nix b/hosts/glyph/services/open-terminal.nix index 411efbaa..be247498 100644 --- a/hosts/glyph/services/open-terminal.nix +++ b/hosts/glyph/services/open-terminal.nix @@ -8,7 +8,7 @@ virtualisation.oci-containers.backend = "podman"; virtualisation.oci-containers.containers.open-terminal = { image = "ghcr.io/open-webui/open-terminal:latest"; - ports = ["8000:8000"]; + ports = ["8001:8000"]; volumes = ["open-terminal:/home/user"]; environmentFiles = [config.age.secrets.open-terminal-env.path]; environment = { diff --git a/lib/secrets/glyph.nix b/lib/secrets/glyph.nix index d28ea350..0e1dba28 100644 --- a/lib/secrets/glyph.nix +++ b/lib/secrets/glyph.nix @@ -14,4 +14,5 @@ in { "hosts/glyph/secrets/user-password.age".publicKeys = keys; "hosts/glyph/secrets/obsidian-auth-token.age".publicKeys = keys; "hosts/glyph/secrets/navidrome-env.age".publicKeys = keys; + "hosts/glyph/secrets/audiomuse-env.age".publicKeys = keys; }