summaryrefslogtreecommitdiffstats
path: root/makefu
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2021-12-28 20:27:11 +0100
committerlassulus <lassulus@lassul.us>2021-12-28 20:27:11 +0100
commitb04c166f8ee82510a35be0bd56853a31ab6d32fc (patch)
treec1f793f30b35a23a0ecac1a1f9728e626580a292 /makefu
parent13a7209ca2b2c12a3a922ade59c49cf4dd9e095e (diff)
parent876aecb4d2f09b82e424cda667c0ccde203ea33c (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu')
-rw-r--r--makefu/2configs/home/tonie.nix68
1 files changed, 68 insertions, 0 deletions
diff --git a/makefu/2configs/home/tonie.nix b/makefu/2configs/home/tonie.nix
new file mode 100644
index 000000000..959e48e8b
--- /dev/null
+++ b/makefu/2configs/home/tonie.nix
@@ -0,0 +1,68 @@
+{ config, pkgs, lib, ... }:
+let
+ backend_port = 30005;
+ #host = config.networking.hostName;
+ ident = 998;
+ user = "${toString ident}:${toString ident}";
+ #backend_host = "tonie.lan";
+ backend_host = "tonie.omo.r";
+ frontend_port = 30006;
+ homedir = "/var/lib/tonies";
+ albumdir = "${homedir}/albumart/";
+ vueconfig = pkgs.writeText "vueconfig" ''
+ module.exports = {
+ devServer: {
+ disableHostCheck: true
+ },
+ }
+ '';
+ audiobookdir = "/media/cryptX/music/kinder_hoerspiele";
+ # TONIE_AUDIO_MATCH_USER = username;
+ # TONIE_AUDIO_MATCH_PASS = password;
+ tonie-env = toString <secrets/tonie.env>;
+in
+ {
+ systemd.tmpfiles.rules = [
+ "d ${albumdir} 1750 toniebox toniebox -"
+ ];
+ networking.firewall.allowedTCPPorts = [ frontend_port backend_port ];
+ virtualisation.oci-containers.containers.toniebox-front = {
+ image = "makefoo/toniebox-audio-match_front:1.0.1";
+ inherit user;
+ environment = {
+ VUE_APP_BACKEND_IS_LOCAL = "true";
+ };
+ ports = [ "${toString frontend_port}:8080" ];
+ volumes = [
+ "${albumdir}:/frontend/public/assets/covers"
+ "${vueconfig}:/frontend/vue.config.js"
+ ];
+ };
+
+ users.users.toniebox = {
+ isSystemUser = true;
+ uid = ident;
+ home = homedir;
+ createHome = true;
+ group = "toniebox";
+ };
+ users.groups.toniebox.gid = ident;
+
+ virtualisation.oci-containers.containers.toniebox-back = {
+ image = "makefoo/toniebox-audio-match_back:1.0.0";
+ inherit user;
+ environmentFiles = [ tonie-env ];
+ ports = [ "${toString backend_port}:5000" ];
+ volumes = [
+ "${albumdir}:/backend/assets/covers"
+ "${audiobookdir}:/backend/assets/audiobooks"
+ ];
+ };
+ services.nginx.virtualHosts."tonie" = {
+ serverAliases = [ "tonie.lan" "tonie.omo.r" backend_host ];
+ locations."/".proxyPass = "http://localhost:${toString frontend_port}";
+ locations."/upload".proxyPass = "http://localhost:${toString backend_port}";
+ locations."/creativetonies".proxyPass = "http://localhost:${toString backend_port}";
+ locations."/audiobooks".proxyPass = "http://localhost:${toString backend_port}";
+ };
+}