From 43e31a8d2d06ff14c1e59883128c1a1cdc1ebc96 Mon Sep 17 00:00:00 2001 From: Zuckerberg Date: Sun, 27 Mar 2022 19:23:07 -0400 Subject: [PATCH] WolframAlpha For drastikbot --- common/server/drastikbot.nix | 10 ++++++++++ machines/liza/configuration.nix | 11 +++++++++-- secrets/secrets.nix | 1 + secrets/wolframalpha.age | Bin 0 -> 1875 bytes 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 secrets/wolframalpha.age diff --git a/common/server/drastikbot.nix b/common/server/drastikbot.nix index 2952a02..ed585a6 100644 --- a/common/server/drastikbot.nix +++ b/common/server/drastikbot.nix @@ -25,6 +25,10 @@ let cp -r ''${arr[1]}/* $out/irc/modules cp -r ''${arr[2]}/* $out/irc/modules + sed -i 's|\(http://drastik.org/drastikbot"\)|\1 " https://git.neet.dev/zuckerberg/dailybuild_modules"|' $out/irc/modules/information.py + sed -i 's|\(https://github.com/olagood/drastikbot_modules\\x0F"\)|\1 " : \\x0311https://git.neet.dev/zuckerberg/dailybuild_modules\\x0F"|' $out/irc/modules/information.py + sed -i 's|AppID = "Enter your AppID here"|import pathlib\nAppID = pathlib.Path("${cfg.wolframAppIdFile}").read_text()|' $out/irc/modules/wolframalpha.py + makeWrapper ${pkgs.python3}/bin/python3 $out/drastikbot \ --prefix PYTHONPATH : ${with pkgs.python3Packages; makePythonPath [requests beautifulsoup4]} \ --add-flags "$out/drastikbot.py" @@ -54,6 +58,12 @@ in { Path to the drastikbot data directory ''; }; + wolframAppIdFile = lib.mkOption { + type = lib.types.str; + description = '' + The file containing the Wolfram Alpha App ID + ''; + }; }; config = lib.mkIf cfg.enable { diff --git a/machines/liza/configuration.nix b/machines/liza/configuration.nix index 325dcfd..7e9c9d0 100644 --- a/machines/liza/configuration.nix +++ b/machines/liza/configuration.nix @@ -122,7 +122,7 @@ in { }); }; - # wrap radio and drastikbot in a VPN + # wrap radio in a VPN containers.vpn-continer = { ephemeral = true; autoStart = true; @@ -175,7 +175,14 @@ in { # load the secret on behalf of the container age.secrets."pia-login.conf".file = ../../secrets/pia-login.conf; - services.drastikbot.enable = true; + services.drastikbot = { + enable = true; + wolframAppIdFile = "/run/agenix/wolframalpha"; + }; + age.secrets.wolframalpha = { + file = ../../secrets/wolframalpha.age; + owner = config.services.drastikbot.user; + }; # icecast endpoint + website services.nginx.virtualHosts."radio.neet.space" = { diff --git a/secrets/secrets.nix b/secrets/secrets.nix index 6d2bb60..5caeab8 100644 --- a/secrets/secrets.nix +++ b/secrets/secrets.nix @@ -15,4 +15,5 @@ in "nextcloud-pw.age".publicKeys = all; "iodine.age".publicKeys = all; "spotifyd.age".publicKeys = all; + "wolframalpha.age".publicKeys = all; } \ No newline at end of file diff --git a/secrets/wolframalpha.age b/secrets/wolframalpha.age new file mode 100644 index 0000000000000000000000000000000000000000..b032c2a9362a159be1f9f5911640e3a1cf26a18a GIT binary patch literal 1875 zcmZXTx6Z=~8HQmb3~UTcUJxbvk9!jc9rxZ_>;p$iT;m=)v12dHh=~m@fPpK3{Yb!l zFu{n#iU@1|8+f1ZE#JA!Kk`1Ew()))`Y(p51Q+=5@e5#{tB*WGa2%$A=fHI23J7ZG zYvM!JG$DxYcA7MEtFHoh92U+Ab*UW*UK3PzV6lTkqR2zzE>$GRnRWDgip(|Uj4D)H z#p)SF3j(Vq=2nP8jkZDT-HVp<@_O_^1 zrh-9>LA=cuK1Dsns^BzwXK&{x?;I}Ty(HCG$}^L=4UAs-oIkG1aD#A`Tt**;Ul+0k zsGmQ1L(WKCtpN7Q=BP^xk%73RKgPO{srXD>i5&G$lX)Z!1qtwmKWwG?~y|;>ZwMKmqBkJkc_^9kNvYa+OYz_#rzy(7s#&IHJwu?17n)Z}#*Hrb5<5cXb{#4W3av!6zTeJ{wQWks*wCZ_64giv!TfpiuZp$Ku;IEaX)Zo4YMi zeHiLI#08ZVv6)eoN_-s-mop4Qb_DrFth0VWYM8ROxNG>nCvU9VGQa*bp|34&_qdLVfUs@FjoXprSSBQ0IG z5p0N>TSL-Gv`|16l`_aEj`2Iq!=Fx30%Z!z*CrlES_lWzw&-A#IiyT0g}+NhL}h!j zE}9#g;c&P**r`4}Hg^GE2MF7!7sF0TdaC(7{fsu{(t3tjZ$6fs>ev{r;MkWsU0Vcy9Wf8DPt{Vxb678`dY}x2e7!wN~JS{&&MFgCUG@R zLY6~gC-2vB?@mWcT<4b(*kcFahrj;Ax4-wN-zMGR8{%Jo{P#cq@%u~po#4yg{qmdt de)qMhzZC!Z*56LQ`TpO3{MSDpzWTxD{SP9(RH^^~ literal 0 HcmV?d00001