From a66570226cffa5e113b89d09324718f772b6d986 Mon Sep 17 00:00:00 2001 From: materus Date: Fri, 22 Mar 2024 20:12:00 +0100 Subject: [PATCH] Add muse bot to valkyrie --- .../host/valkyrie/secrets/default.nix | 6 ++- .../host/valkyrie/secrets/secrets.yaml | 8 +++- .../host/valkyrie/services/default.nix | 4 +- .../host/valkyrie/services/muse.nix | 41 +++++++++++++++++++ 4 files changed, 54 insertions(+), 5 deletions(-) create mode 100644 configurations/host/valkyrie/services/muse.nix diff --git a/configurations/host/valkyrie/secrets/default.nix b/configurations/host/valkyrie/secrets/default.nix index 637e898..925e770 100644 --- a/configurations/host/valkyrie/secrets/default.nix +++ b/configurations/host/valkyrie/secrets/default.nix @@ -11,7 +11,11 @@ sops.defaultSopsFile = materusCfg.hostPath + "/secrets/secrets.yaml"; sops.secrets.wireguard = { }; - + sops.secrets.discord-token = {}; + sops.secrets.spotify-client-id = {}; + sops.secrets.spotify-client-secret = {}; + sops.secrets.youtube-api = {}; + services.openssh.hostKeys = [ { bits = 4096; diff --git a/configurations/host/valkyrie/secrets/secrets.yaml b/configurations/host/valkyrie/secrets/secrets.yaml index 6f1a399..bfe72c6 100644 --- a/configurations/host/valkyrie/secrets/secrets.yaml +++ b/configurations/host/valkyrie/secrets/secrets.yaml @@ -1,4 +1,8 @@ wireguard: ENC[AES256_GCM,data:i98U0ugxbNqWNuKR8u+mdWoSMLViHXfsWRBS1lvjb+hgGxveyzjBcagBIeY=,iv:/hF9oH2R6NSeHT/UQTlbmtx+gPX/3CJOLPNnxrzsY/g=,tag:2ub5w8uH2O1B2hoku8Kowg==,type:str] +discord-token: ENC[AES256_GCM,data:JQ/6MJvBlJpKzs/L0hFB1LPpQSfJvDdEB6YerVZyDqGo7plA0S5wORACgA88Dei1x1NGsXhYtiwT4vE9jjeCOlWXZdl1mA==,iv:BsDu1De0qLX/8VDiZ5co1q1LXxkz/Som9+hvm/67/xU=,tag:YO0wQNF3/AXbifpeAa935Q==,type:str] +spotify-client-id: ENC[AES256_GCM,data:WK7CJGw6mtIG3Jfp59cWx3ool4z1P09TvHcpbOQ2JV0=,iv:EaJ5ecXdmx0Ky+43xZITM811IOo4EisvPSyogXrJXng=,tag:NYTI4vLsWGa695CJ+TIgbw==,type:str] +spotify-client-secret: ENC[AES256_GCM,data:TnR+zLLklTfzMdR4woaZWuMVJQ9VIYsFM588GRO6WCY=,iv:cYiqw8ZdMgLeug4ptwPV3L+MeY6xIldfUBfiYg1mFD8=,tag:YDLh6BXFcBHnpdgM7e87wg==,type:str] +youtube-api: ENC[AES256_GCM,data:qmpFlFvudS9rXQfN+Th/UrPWCW0mg5GkpMucS/01AmOnlChqtojC,iv:q3bKwI2I6BNa3L9ezKCE1fWT/vZLiJ8uzug1z2z+TWA=,tag:gKG3HTz8jp2LAFh8e8O6sg==,type:str] sops: kms: [] gcp_kms: [] @@ -14,8 +18,8 @@ sops: d2dMUUh1RDB3UnpEdFJsNHpQRXFWemMKc41dlOapTsvH91QLNhdPbrzerPFakOiX J/uoZDMIhsmQxgQM7Fqxr05NywhI/ZjOtJS2bayp73O57xjjMYcyNQ== -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-03-21T22:56:14Z" - mac: ENC[AES256_GCM,data:bh6fCWIn4Ppv0NSa2qXPIi2O0VfRqZCUqcvPFttrh1Q1BISkBFrX5uz7Zq5OTE0HzUMDhHq2/uQGqKjao9qyDYhaP20Ffh2HbQGvIvOZLtyKzT12LVwBLxSAsJ9l6fF+sDLrT98f4vDiu/8dyRnhDAV4V9DUNbDi/gF4imjoyXQ=,iv:Xh+nK7DyogwUxMPO4qbZgL9XptOISH/qTRaml9HjWAw=,tag:gzZ4ZRd6LjvsN9Axd4aykQ==,type:str] + lastmodified: "2024-03-22T18:29:22Z" + mac: ENC[AES256_GCM,data:X4SJZ4A7YwQGGvdjf0/hKSn6HuiwKC0DaswzAgA+sqfXnwTAFt1FPhak//BxkRKBqw5A+FTyRf/a4FnY5XG+gu3RxO6+np4AJwvKiA0Hwa9QImwrh9A1k9URE9mtGegqtw3wnZBw4XXA+vhEUIq10sGaVuy6outfvlfNM/TMlgc=,iv:WENShl1jCAUQggvssZMS+6vEgc8l+wzZLHXRkoYAV8I=,tag:2y6ltpwxUIOlaUMoWDRcxg==,type:str] pgp: - created_at: "2024-03-21T22:55:36Z" enc: |- diff --git a/configurations/host/valkyrie/services/default.nix b/configurations/host/valkyrie/services/default.nix index a1458bb..94353e8 100644 --- a/configurations/host/valkyrie/services/default.nix +++ b/configurations/host/valkyrie/services/default.nix @@ -4,12 +4,12 @@ [ ./pleroma.nix ./pihole.nix + ./muse.nix ]; services.adguardhome.enable = true; valkyrieService.pihole.enable = false; valkyrieService.pleroma.enable = true; - - + valkyrieService.muse.enable = true; } diff --git a/configurations/host/valkyrie/services/muse.nix b/configurations/host/valkyrie/services/muse.nix new file mode 100644 index 0000000..0e95e18 --- /dev/null +++ b/configurations/host/valkyrie/services/muse.nix @@ -0,0 +1,41 @@ +{ config, pkgs, lib, materusArg, ... }: +{ + options.valkyrieService.muse.enable = materusArg.pkgs.lib.mkBoolOpt false "Enable pihole"; + + + + + config = + let + cfg = config.valkyrieService.muse; + in + lib.mkIf cfg.enable { + sops.templates."muse.env".content = '' + CACHE_LIMIT=512MB + BOT_STATUS=online + BOT_ACTIVITY_TYPE=LISTENING + BOT_ACTIVITY=Coś + DISCORD_TOKEN=${config.sops.placeholder.discord-token} + YOUTUBE_API_KEY=${config.sops.placeholder.youtube-api} + SPOTIFY_CLIENT_ID=${config.sops.placeholder.spotify-client-id} + SPOTIFY_CLIENT_SECRET=${config.sops.placeholder.spotify-client-secret} + ''; + + systemd.tmpfiles.rules = [ + "d /var/lib/muse 0776 root root -" + ]; + + virtualisation.oci-containers.containers.muse = { + image = "codetheweb/muse:latest"; + volumes = [ + "/var/lib/muse:/data" + ]; + environmentFiles = [ + config.sops.templates."muse.env".path + ]; + }; + + }; + + +}