diff options
Diffstat (limited to 'vps-configuration.nix')
-rw-r--r-- | vps-configuration.nix | 49 |
1 files changed, 35 insertions, 14 deletions
diff --git a/vps-configuration.nix b/vps-configuration.nix index 35694da..6c8464f 100644 --- a/vps-configuration.nix +++ b/vps-configuration.nix @@ -37,7 +37,6 @@ let matrixServerJSON = { "m.server" = "${matrixDomain}:443"; }; matrixClientJSON = { "m.homeserver" = { "base_url" = "https://${TLD}"; }; }; matrixPort = 8008; - mautrixWappDir = "/home/${envsubstConfiguration.userName}/mautrix-wapp"; }; staticSiteFromRepo = repoName: pkgs.stdenv.mkDerivation { @@ -67,20 +66,23 @@ let poetry run flask inicializar-banco poetry run waitress-serve --host localhost --port ${config.piresProdPort} --call pires:create_app '').overrideAttrs (baseAttrs: { buildInputs = with pkgs; [ git poetry ]; }); - mautrix-wapp = (pkgs.writeShellScriptBin "run-mautrix-wapp.sh" '' - set -x - DIR=${config.mautrixWappDir} + mautrix-whatsapp = pkgs.writeShellScriptBin "run-mautrix-whatsapp.sh" '' + pushd $HOME + mkdir -p logs + ${pkgsUnstable.mautrix-whatsapp}/bin/mautrix-whatsapp -g -c /data/mautrix-whatsapp-config.yaml -r /data/mautrix-whatsapp-registration.yaml + ${pkgsUnstable.mautrix-whatsapp}/bin/mautrix-whatsapp -c /data/mautrix-whatsapp-config.yaml + ''; + mautrix-telegram = pkgs.writeShellScriptBin "run-mautrix-telegram.sh" '' + DIR=$HOME/mautrix-telegram if [[ ! -d "$DIR" ]]; then - git clone https://github.com/tulir/mautrix-whatsapp.git "$DIR" + ${pkgs.git}/bin/git clone https://github.com/tulir/mautrix-telegram.git "$DIR" fi pushd "$DIR" - git pull - ./build.sh - cp ../config.yaml . - ./mautrix-whatsapp -g - cp registration.yaml /data/ - ./mautrix-whatsapp - '').overrideAttrs (baseAttrs: { buildInputs = with pkgs; [ git olm go ]; }); + ${pkgs.git}/bin/git pull + ${pkgsUnstable.mautrix-telegram}/bin/mautrix-telegram -g -c /data/mautrix-telegram-config.yaml -r /data/mautrix-telegram-registration.yaml + ${pkgs.python3Packages.alembic}/bin/alembic -x config=/data/mautrix-telegram-config.yaml upgrade head + ${pkgsUnstable.mautrix-telegram}/bin/mautrix-telegram -c /data/mautrix-telegram-config.yaml + ''; in { nix = { binaryCaches = [ "https://euandreh.cachix.org" ]; @@ -108,6 +110,8 @@ in { gotop matrix-synapse poetry + pkgsUnstable.mautrix-whatsapp + pkgsUnstable.mautrix-telegram ]; networking.firewall.allowedTCPPorts = [ @@ -397,7 +401,10 @@ in { compress = false; }]; }]; - app_service_config_files = [ "/data/registration.yaml" ]; + app_service_config_files = [ + "/data/mautrix-whatsapp-registration.yaml" + # "/data/mautrix-telegram-registration.yaml" + ]; }; }; @@ -458,7 +465,21 @@ in { # Service serviceConfig = { User = "${envsubstConfiguration.userName}"; - ExecStart = "${mautrix-wapp}/bin/run-mautrix-wapp.sh"; + ExecStart = "${mautrix-whatsapp}/bin/run-mautrix-whatsapp.sh"; + Restart = "always"; + }; + # Install + wantedBy = [ "multi-user.target" ]; + }; + "mautrix-telegram" = { + enable = false; + # Unit + description = "mautrix-telegram systemd service"; + after = [ "network.target" ]; + # Service + serviceConfig = { + User = "${envsubstConfiguration.userName}"; + ExecStart = "${mautrix-telegram}/bin/run-mautrix-telegram.sh"; Restart = "always"; }; # Install |