Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nixos/modules/services/matrix/mjolnir.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let

# these config files will be merged one after the other to build the final config
configFiles = [
"${pkgs.mjolnir}/share/mjolnir/config/default.yaml"
"${pkgs.mjolnir}/libexec/mjolnir/deps/mjolnir/config/default.yaml"
moduleConfigFile
];

Expand Down Expand Up @@ -200,7 +200,7 @@ in
wantedBy = [ "multi-user.target" ];

serviceConfig = {
ExecStart = ''${pkgs.mjolnir}/bin/mjolnir'';
ExecStart = ''${pkgs.mjolnir}/bin/mjolnir --mjolnir-config ./config/default.yaml'';
ExecStartPre = [ generateConfig ];
WorkingDirectory = cfg.dataPath;
StateDirectory = "mjolnir";
Expand Down
3 changes: 2 additions & 1 deletion nixos/tests/matrix/mjolnir.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import ../make-test-python.nix (
name = "mjolnir";
meta = with pkgs.lib; {
maintainers = teams.matrix.members;
broken = true; # times out after spending many hours
};

nodes = {
Expand Down Expand Up @@ -99,6 +98,8 @@ import ../make-test-python.nix (
enable = true;
username = "mjolnir";
passwordFile = pkgs.writeText "password.txt" "mjolnir-password";
# otherwise mjolnir tries to connect to ::1, which is not listened by pantalaimon
options.listenAddress = "127.0.0.1";
};
managementRoom = "#moderators:homeserver";
};
Expand Down
65 changes: 27 additions & 38 deletions pkgs/servers/mjolnir/default.nix
Original file line number Diff line number Diff line change
@@ -1,67 +1,56 @@
{ lib
, nixosTests
, stdenv
, mkYarnPackage
, fetchFromGitHub
, fetchYarnDeps
, matrix-sdk-crypto-nodejs
, makeWrapper
, nodejs
, pkgs
, nixosTests
}:

stdenv.mkDerivation rec {
mkYarnPackage rec {
pname = "mjolnir";
version = "1.5.0";
version = "1.6.4";

src = fetchFromGitHub {
owner = "matrix-org";
repo = "mjolnir";
rev = "v${version}";
sha256 = "YmP+r9W5e63Aw66lSQeTTbYwSF/vjPyHkoehJxtcRNw=";
rev = "refs/tags/v${version}";
hash = "sha256-/vnojWLpu/fktqPUhAdL1QTESxDwFrBVYAkyF79Fj9w=";
};

nativeBuildInputs = [
nodejs
makeWrapper
];
packageJSON = ./package.json;

buildPhase =
let
nodeDependencies = ((import ./node-composition.nix {
inherit pkgs nodejs;
inherit (stdenv.hostPlatform) system;
}).nodeDependencies.override (old: {
# access to path '/nix/store/...-source' is forbidden in restricted mode
src = src;
dontNpmInstall = true;
}));
in
''
runHook preBuild
offlineCache = fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-B4s0CYr5Ihoh4gkckwZ3z0Nb4LMET48WvRXuhk3fpQM=";
};

ln -s ${nodeDependencies}/lib/node_modules .
export HOME=$(mktemp -d)
export PATH="${nodeDependencies}/bin:$PATH"
npm run build
packageResolutions = {
"@matrix-org/matrix-sdk-crypto-nodejs" = "${matrix-sdk-crypto-nodejs}/lib/node_modules/@matrix-org/matrix-sdk-crypto-nodejs";
};

runHook postBuild
'';
nativeBuildInputs = [ makeWrapper ];

installPhase = ''
runHook preInstall
buildPhase = ''
runHook preBuild

mkdir -p $out/share
cp -a . $out/share/mjolnir
pushd deps/${pname}
yarn run build
popd

makeWrapper ${nodejs}/bin/node $out/bin/mjolnir \
--add-flags $out/share/mjolnir/lib/index.js
runHook postBuild
'';

runHook postInstall
postInstall = ''
makeWrapper ${nodejs}/bin/node "$out/bin/mjolnir" \
--add-flags "$out/libexec/mjolnir/deps/mjolnir/lib/index.js"
'';

passthru = {
tests = {
inherit (nixosTests) mjolnir;
};
updateScript = ./update.sh;
};

meta = with lib; {
Expand Down
17 changes: 0 additions & 17 deletions pkgs/servers/mjolnir/node-composition.nix

This file was deleted.

Loading