This commit is contained in:
dusk 2022-09-02 18:02:46 +03:00
parent 8af465a289
commit b6fea862d6
Signed by: dusk
GPG Key ID: 1D8F8FAF2294D6EA
3 changed files with 48 additions and 35 deletions

View File

@ -1,21 +1,37 @@
{config, pkgs, ...}: {
let config,
wellKnownFileClient = pkgs,
pkgs.writeText "client" ( ...
}: let
_wellKnownFileClient = pkgs.writeText "client" (
builtins.toJSON builtins.toJSON
{"m.homeserver"."base_url" = "https://matrix.gaze.systems";} {"m.homeserver"."base_url" = "https://matrix.gaze.systems";}
); );
wellKnownFileServer = _wellKnownFileServer =
pkgs.writeText "server" pkgs.writeText "server"
(builtins.toJSON {"m.server" = "matrix.gaze.systems:443";}); (builtins.toJSON {"m.server" = "matrix.gaze.systems:443";});
in wellKnownFiles = pkgs.runCommand "well-known" {} ''
{ mkdir -p $out
cp ${_wellKnownFileServer} $out/server
cp ${_wellKnownFileClient} $out/client
'';
in {
services.matrix-conduit = { services.matrix-conduit = {
enable = true; enable = true;
package = pkgs.matrix-conduit.overrideAttrs (old: rec {
name = "${old.pname}-${version}";
version = "147f2752";
src = pkgs.fetchFromGitLab {
owner = "famedly";
repo = "conduit";
rev = "147f27521c0d7dbc32d39ec1d8da6cd00008f23c";
sha256 = "sha256-j469Zh8zyqJNWz7q6gjRu1Khk9y6Xbb52SpxzNjADW8=";
};
});
settings.global = { settings.global = {
server_name = "gaze.systems"; server_name = "gaze.systems";
max_request_size = 1000 * 1000 * 20; max_request_size = 1000 * 1000 * 20;
allow_registration = true; allow_registration = false;
allow_federation = true; allow_federation = true;
trusted_servers = ["matrix.org" "nixos.dev" "conduit.rs"]; trusted_servers = ["matrix.org" "nixos.dev" "conduit.rs"];
address = "::1"; address = "::1";
@ -26,15 +42,12 @@ in
services.nginx.virtualHosts."matrix.gaze.systems" = { services.nginx.virtualHosts."matrix.gaze.systems" = {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/".proxyPass = locations."/".proxyPass = "http://localhost:${toString config.services.matrix-conduit.settings.global.port}";
"http://localhost:${toString config.services.matrix-conduit.settings.global.port}";
}; };
services.nginx.virtualHosts."gaze.systems" = { services.nginx.virtualHosts."gaze.systems" = {
locations."/.well-known/matrix/client".extraConfig = '' locations."/.well-known/matrix/".extraConfig = ''
alias ${wellKnownFileClient}; add_header content-type application/json;
''; alias ${wellKnownFiles}/;
locations."/.well-known/matrix/server".extraConfig = ''
alias ${wellKnownFileServer};
''; '';
}; };
} }

View File

@ -17,11 +17,10 @@
home.persistence."${config.system.persistDir}${config.home.homeDirectory}".directories = [ home.persistence."${config.system.persistDir}${config.home.homeDirectory}".directories = [
".config/WebCord" ".config/WebCord"
]; ];
home.packages = home.packages = let
let
pkg = inputs.webcord.packages.${pkgs.system}.webcord; pkg = inputs.webcord.packages.${pkgs.system}.webcord;
in in [
[( (
pkgs.runCommand pkg.name {nativeBuildInputs = [pkgs.makeWrapper];} '' pkgs.runCommand pkg.name {nativeBuildInputs = [pkgs.makeWrapper];} ''
mkdir -p $out mkdir -p $out
ln -sf ${pkg}/* $out/ ln -sf ${pkg}/* $out/
@ -31,5 +30,6 @@
wrapProgram $out/bin/webcord \ wrapProgram $out/bin/webcord \
--prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [pkgs.pipewire]}" --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [pkgs.pipewire]}"
'' ''
)]; )
];
} }