diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..63282bc
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/modules.xml
+/projectSettingsUpdater.xml
+/.idea.OOYE-module.iml
+/contentModel.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..df87cf9
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
+</project>
\ No newline at end of file
diff --git a/.idea/indexLayout.xml b/.idea/indexLayout.xml
new file mode 100644
index 0000000..05bc41e
--- /dev/null
+++ b/.idea/indexLayout.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="UserContentModel">
+ <attachedFolders />
+ <explicitIncludes />
+ <explicitExcludes>
+ <Path>result</Path>
+ </explicitExcludes>
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="Git" />
+ </component>
+</project>
\ No newline at end of file
diff --git a/default.nix b/default.nix
index 31668cf..20385a4 100644
--- a/default.nix
+++ b/default.nix
@@ -4,30 +4,39 @@
makeWrapper,
nodejs,
buildNpmPackage,
+ inspectorPort ? null,
}:
buildNpmPackage {
pname = "out-of-your-element";
version = "0";
src = fetchgit {
url = "https://gitdab.com/cadence/out-of-your-element.git";
- rev = "efaa59ca9293a56b57d997d3dc7c5bd7564d07d4";
- sha256 = "sha256-KxpmqxELXWCAPefa2bHyFTtPkvZkaeZqEL9fi6w6rLw=";
+ rev = "d8e6de62e50b75e02fdfc9d57fc613d561faa033";
+ sha256 = "sha256-V99u6qLxuhcHoUYMlxuVI68dO5voeRkl2sC6eEaC9Bw=";
};
- npmDepsHash = "sha256-HNHEGez8X7CsoGYXqzB49o1pcCImfmGYIw9QKF2SbHo=";
+ npmDepsHash = "sha256-TzXkgBzGYegtmhC2ZaBpyNBKmezO+AHM/jUa9HN+IsQ=";
dontNpmBuild = true;
- nativeBuildInputs = [makeWrapper];
+ nativeBuildInputs = [ makeWrapper ];
- installPhase = ''
- runHook preInstall
+ installPhase =
+ let
+ enableInspector = inspectorPort != null;
+ extraNodeFlags = lib.optionalString enableInspector "--inspect=127.0.0.1:${inspectorPort}";
+ in
+ ''
+ runHook preInstall
- mkdir -p $out/share
- cp -a . $out/share/ooye
- makeWrapper ${nodejs}/bin/node $out/bin/matrix-ooye --add-flags $out/share/ooye/start.js
- makeWrapper ${nodejs}/bin/node $out/bin/matrix-ooye-addbot --add-flags $out/share/ooye/addbot.js
+ mkdir -p $out/share
+ cp -a . $out/share/ooye
+ ''
+ + (if enableInspector then "echo 'Enabling Node.js inspector'; sed -i '1i\\#!/usr/bin/env node --inspect' $out/share/ooye/start.js" else "")
+ + ''
+ makeWrapper ${nodejs}/bin/node $out/bin/matrix-ooye --add-flags ${extraNodeFlags} $out/share/ooye/start.js
+ makeWrapper ${nodejs}/bin/node $out/bin/matrix-ooye-addbot --add-flags $out/share/ooye/addbot.js
- runHook postInstall
- '';
+ runHook postInstall
+ '';
meta = with lib; {
description = "Matrix-Discord bridge with modern features.";
diff --git a/flake.lock b/flake.lock
index cd2b62f..3c2b40c 100644
--- a/flake.lock
+++ b/flake.lock
@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
- "lastModified": 1749285348,
- "narHash": "sha256-frdhQvPbmDYaScPFiCnfdh3B/Vh81Uuoo0w5TkWmmjU=",
+ "lastModified": 1758277210,
+ "narHash": "sha256-iCGWf/LTy+aY0zFu8q12lK8KuZp7yvdhStehhyX1v8w=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "3e3afe5174c561dee0df6f2c2b2236990146329f",
+ "rev": "8eaee110344796db060382e15d3af0a9fc396e0e",
"type": "github"
},
"original": {
diff --git a/module.nix b/module.nix
index 4f437f2..17530f5 100644
--- a/module.nix
+++ b/module.nix
@@ -30,6 +30,12 @@ in
socket = mkStringOption "The socket to listen on, can either be a port number or a unix socket path." "6693";
bridgeOrigin = mkStringOption "The web frontend URL for the bridge, defaults to http://localhost:{socket}" "";
+ debugPort = lib.mkOption {
+ type = lib.types.nullOr lib.types.int;
+ default = null;
+ description = "If set, enables the Node.js inspector on the given port.";
+ };
+
enableSynapseIntegration = lib.mkEnableOption "Enable Synapse integration";
};
};
@@ -95,18 +101,18 @@ in
AS_TOKEN=$(${lib.getExe pkgs.openssl} rand -hex 64)
echo "Generated new AS token: ''${AS_TOKEN}"
fi
-
+
if [[ -z "$HS_TOKEN" || "$HS_TOKEN" == "null" ]]; then
HS_TOKEN=$(${lib.getExe pkgs.openssl} rand -hex 64)
echo "Generated new HS token: ''${HS_TOKEN}"
fi
-
+
if [[ -z "$DISCORD_TOKEN" ]]; then
echo "No Discord token found at '${cfg.discordTokenPath}'"
echo "You can find this on the 'Bot' tab of your Discord application."
exit 1
fi
-
+
if [[ -z "$DISCORD_CLIENT_SECRET" ]]; then
echo "No Discord client secret found at '${cfg.discordTokenPath}'"
echo "You can find this on the 'OAuth2' tab of your Discord application."
@@ -170,7 +176,11 @@ in
wantedBy = [ "multi-user.target" ];
serviceConfig = {
- ExecStart = lib.getExe config.services.matrix-ooye.package;
+ ExecStart = lib.getExe (
+ config.services.matrix-ooye.package.mkOverride {
+ inspectorPort = cfg.debugPort;
+ }
+ );
WorkingDirectory = "/var/lib/matrix-ooye";
StateDirectory = "matrix-ooye";
#ProtectSystem = "strict";
@@ -184,7 +194,6 @@ in
};
systemd.services."matrix-synapse" = lib.mkIf cfg.enableSynapseIntegration {
-
after = [
"matrix-ooye-pre-start.service"
"network-online.target"
|