Some cleanup

This commit is contained in:
Rory& 2024-07-20 10:14:58 +02:00
parent 0d980840a4
commit 2166b940a9
20 changed files with 122 additions and 1468 deletions

5
.gitattributes vendored
View file

@ -1 +1,4 @@
* text=auto eol=lf
* text=auto eol=lf
# We don't want git to display diffs for this file because they're way too long.
flake.lock -diff

View file

@ -22,6 +22,6 @@ else
nix build .#nixosConfigurations.${2}.config.system.build.toplevel --extra-experimental-features nix-command --extra-experimental-features flakes || exit 1
nixos-install --root "${1}" --flake ".#${2}"
git rm --cached hardware-configuration.nix
cp . "${1}/Rory-Open-Architecture" -r
cp . "${1}/Litenet-Nix-Infra" -r
exit
fi

View file

@ -25,6 +25,8 @@
./host/matrix/configuration.nix
./hardware-configuration.nix
./modules/packages/ooye/module/main.nix
home-manager.nixosModules.home-manager
# Rory&'s user

View file

@ -9,9 +9,9 @@
imports = [
../../modules/base-server.nix
./services/postgres.nix
./services/matrix/root.nix
./services/nginx/nginx.nix
./postgres.nix
./matrix/root.nix
./nginx/nginx.nix
];
networking = {
hostName = "matrix";
@ -24,7 +24,7 @@
defaultGateway.interface = "ens18";
};
hardware.enableAllFirmware = false;
hardware.enableRedistributableFirmware = false;
services.ooye.enable = false;
system.stateVersion = "22.11"; # DO NOT EDIT!
}

View file

@ -67,6 +67,20 @@
}
];
}
{
type = "http";
path = "/run/matrix-synapse/main-http.sock";
mode = "666";
resources = [
{
names = [
"client"
"federation"
];
compress = false;
}
];
}
];
dynamic_thumbnails = true;
presence = {
@ -78,7 +92,6 @@
name = "psycopg2";
args = {
user = "matrix-synapse";
#passwordFile = "/run/secrets/matrix-synapse-password";
password = "somepassword";
database = "matrix-synapse";
host = "127.0.0.1";
@ -93,61 +106,6 @@
# "/var/lib/matrix-synapse/modas-registration.yaml"
];
# rc_message = {
# per_second = 1000;
# burst_count = 1000;
# };
# rc_login = {
# address = {
# per_second = 1000;
# burst_count = 1000;
# };
# account = {
# per_second = 1000;
# burst_count = 1000;
# };
# failed_attempts = {
# per_second = 0.1;
# burst_count = 3;
# };
# };
# rc_joins = {
# local = {
# per_second = 1000;
# burst_count = 1000;
# };
# remote = {
# per_second = 1000;
# burst_count = 1000;
# };
# };
# rc_joins_per_room = {
# per_second = 1000;
# burst_count = 1000;
# };
# rc_invites = {
# per_room = {
# per_second = 1000;
# burst_count = 1000;
# };
# per_user = {
# per_second = 1000;
# burst_count = 1000;
# };
# per_issuer = {
# per_second = 1000;
# burst_count = 1000;
# };
# };
# rc_federation = {
# window_size = 10;
# sleep_limit = 1000;
# sleep_delay = 100;
# reject_limit = 1000;
# concurrent = 100;
# };
# federation_rr_transactions_per_room_per_second = 1;
max_image_pixels = "100M";
ui_auth = {
@ -160,10 +118,6 @@
token_timeout = "1y";
};
#sentry = {
# dsn = "https://77c8de07855d4e0c90dbcf0945a04f01@sentry.thearcanebrony.net/14";
#};
report_stats = false;
user_directory = {
@ -173,31 +127,12 @@
};
experimental_features = {
"org.matrix.msc3026.busy_presence" = true;
"fi.mau.msc2815" = true;
"org.matrix.msc3881" = true;
"org.matrix.msc3874" = true;
"org.matrix.msc3912" = true;
"msc2815_enabled" = true; # Redacted event content
"msc3026_enabled" = true; # Busy presence
"msc3266_enabled" = true; # Room summary API
"msc3916_authenticated_media_enabled" = true; # Authenticated media
};
};
plugins = with pkgs.matrix-synapse-plugins; [
# Alicia - need to port draupnir...
#matrix-synapse-mjolnir-antispam
# matrix-synapse-pam
];
# extraConfigFiles = [
# (pkgs.writeTextFile {
# name = "matrix-synapse-extra-config.yml";
# text = ''
# modules:
# - module: "pam_auth_provider.PAMAuthProvider"
# config:
# create_users: true
# skip_user_check: false
# '';
# })
# ];
};
systemd.services.matrix-synapse-reg-token = {

View file

@ -2,19 +2,12 @@
enableACME = false;
addSSL = false;
locations."/" = {
#proxyPass = "http://127.0.0.1:9001";
proxyPass = "http://localhost:8008";
extraConfig = ''
if ($request_method = 'OPTIONS') {
more_set_headers 'Access-Control-Allow-Origin: *';
more_set_headers 'Access-Control-Allow-Methods: *';
#
# Custom headers and headers various browsers *should* be OK with but aren't
#
more_set_headers 'Access-Control-Allow-Headers: *, Authorization';
#
# Tell client that this pre-flight info is valid for 20 days
#
more_set_headers 'Access-Control-Max-Age: 1728000';
more_set_headers 'Content-Type: text/plain; charset=utf-8';
more_set_headers 'Content-Length: 0';

View file

@ -16,7 +16,6 @@
recommendedGzipSettings = true;
recommendedBrotliSettings = true;
recommendedOptimisation = true;
defaultMimeTypes = ../../../../modules/packages/nginx/mime.types;
appendConfig = ''
worker_processes 16;
'';
@ -28,12 +27,11 @@
#sendfile on;
disable_symlinks off;
'';
upstreams = import ./matrix-upstreams.nix;
additionalModules = with pkgs.nginxModules; [ moreheaders ];
virtualHosts = {
#matrix...
"matrix.litenet.tel" = import ./litenet.tel/matrix.nix;
"matrix.localhost" = import ./localhost/matrix.nix;
"matrix.localhost" = (import ./litenet.tel/matrix.nix) // { addSSL = false; enableACME = false; };
};
};
};

View file

@ -1,279 +0,0 @@
{
enableACME = false;
addSSL = false;
# locations."/_matrix" = {
# proxyPass = "http://192.168.1.5:8008";
# extraConfig = ''
# if ($request_method = 'OPTIONS') {
# more_set_headers 'Access-Control-Allow-Origin: *';
# more_set_headers 'Access-Control-Allow-Methods: *';
# #
# # Custom headers and headers various browsers *should* be OK with but aren't
# #
# more_set_headers 'Access-Control-Allow-Headers: *';
# #
# # Tell client that this pre-flight info is valid for 20 days
# #
# more_set_headers 'Access-Control-Max-Age' 1728000;
# more_set_headers 'Content-Type: text/plain; charset=utf-8';
# more_set_headers 'Content-Length' 0;
# return 204;
# };
# '';
# };
# https://matrix-org.github.io/synapse/latest/workers.html#synapseappgeneric_worker
locations."~ ^/_matrix/client/(r0|v3)/sync$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
extraConfig = ''
proxy_read_timeout 3600;
proxy_connect_timeout 3600;
proxy_send_timeout 3600;
'';
};
locations."~ ^/_matrix/client/(api/v1|r0|v3)/events$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3)/initialSync$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3)/rooms/[^/]+/initialSync$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/createRoom$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/publicRooms$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/joined_members$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/context/.*$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/members$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/v1/rooms/.*/hierarchy$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(v1|unstable)/rooms/.*/relations/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/v1/rooms/.*/threads$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/unstable/org.matrix.msc2716/rooms/.*/batch_send$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/unstable/im.nheko.summary/rooms/.*/summary$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/account/3pid$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/account/whoami$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/devices$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/versions$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/voip/turnServer$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/event/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/v1/rooms/.*/timestamp_to_event$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/search$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/keys/query$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/keys/changes$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/keys/claim$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/room_keys/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/keys/upload/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/login$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/register$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/v1/register/m.login.registration_token/validity$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/join/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/profile/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
# https://matrix-org.github.io/synapse/latest/workers.html#the-typing-stream
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing" = {
proxyPass = "http://stream_writer_typing_stream_workers_upstream$request_uri";
};
# https://matrix-org.github.io/synapse/latest/workers.html#the-to_device-stream
locations."~ ^/_matrix/client/(r0|v3|unstable)/sendToDevice/" = {
proxyPass = "http://stream_writer_to_device_stream_workers_upstream$request_uri";
};
# https://matrix-org.github.io/synapse/latest/workers.html#the-account_data-stream
locations."~ ^/_matrix/client/(r0|v3|unstable)/.*/tags" = {
proxyPass = "http://stream_writer_account_data_stream_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/.*/account_data" = {
proxyPass = "http://stream_writer_account_data_stream_workers_upstream$request_uri";
};
# https://matrix-org.github.io/synapse/latest/workers.html#the-receipts-stream
locations."~ ^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt" = {
proxyPass = "http://stream_writer_receipts_stream_workers_upstream$request_uri";
};
locations."~ ^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers" = {
proxyPass = "http://stream_writer_receipts_stream_workers_upstream$request_uri";
};
# https://matrix-org.github.io/synapse/latest/workers.html#the-presence-stream
locations."~ ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/" = {
proxyPass = "http://stream_writer_presence_stream_workers_upstream$request_uri";
};
### DUPLICATES????
# https://matrix-org.github.io/synapse/latest/workers.html#updating-the-user-directory
locations."~ ^/_matrix/client/(r0|v3|unstable)/user_directory/search$" = {
proxyPass = "http://user_dir_workers_upstream$request_uri";
};
# ???
locations."/" = {
#resolver 127.0.0.11 valid=5s;
#set $backend "matrix-synapse:8008";
#proxyPass = "http://$backend";
proxyPass = "http://127.0.0.1:8008";
};
locations."~ ^/_matrix/federation/v1/event/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/state/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/state_ids/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/backfill/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/get_missing_events/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/publicRooms" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/query/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/make_join/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/make_leave/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/(v1|v2)/send_join/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/(v1|v2)/send_leave/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/(v1|v2)/invite/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/event_auth/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/timestamp_to_event/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/exchange_third_party_invite/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/user/devices/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/key/v2/query" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/hierarchy/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
locations."~ ^/_matrix/federation/v1/send/" = {
proxyPass = "http://generic_workers_upstream$request_uri";
};
##### media repo
# https://matrix-org.github.io/synapse/latest/workers.html#synapseappmedia_repository
locations."~ ^/_matrix/media/" = {
proxyPass = "http://media_repository_workers_upstream$request_uri";
};
locations."~ ^/_synapse/admin/v1/purge_media_cache$" = {
proxyPass = "http://media_repository_workers_upstream$request_uri";
};
locations."~ ^/_synapse/admin/v1/room/.*/media.*$" = {
proxyPass = "http://media_repository_workers_upstream$request_uri";
};
locations."~ ^/_synapse/admin/v1/user/.*/media.*$" = {
proxyPass = "http://media_repository_workers_upstream$request_uri";
};
locations."~ ^/_synapse/admin/v1/media/.*$" = {
proxyPass = "http://media_repository_workers_upstream$request_uri";
};
locations."~ ^/_synapse/admin/v1/quarantine_media/.*$" = {
proxyPass = "http://media_repository_workers_upstream$request_uri";
};
locations."~ ^/_synapse/admin/v1/users/.*/media$" = {
proxyPass = "http://media_repository_workers_upstream$request_uri";
};
#locations."/" = {
#resolver 127.0.0.11 valid=5s;
#set $backend "matrix-synapse:8048";
#proxyPass = "http://$backend";
#};
locations."/_synapse/client".proxyPass = "http://127.0.0.1:8008";
}

View file

@ -1,26 +0,0 @@
{
generic_workers_upstream.servers = {
"127.0.0.1:18111" = { };
};
stream_writer_typing_stream_workers_upstream.servers = {
"127.0.0.1:20012" = { };
};
stream_writer_to_device_stream_workers_upstream.servers = {
"127.0.0.1:20013" = { };
};
stream_writer_account_data_stream_workers_upstream.servers = {
"127.0.0.1:20014" = { };
};
stream_writer_receipts_stream_workers_upstream.servers = {
"127.0.0.1:20015" = { };
};
stream_writer_presence_stream_workers_upstream.servers = {
"127.0.0.1:20016" = { };
};
media_repository_workers_upstream.servers = {
"127.0.0.1:18551" = { };
};
user_dir_workers_upstream.servers = {
"127.0.0.1:18661" = { };
};
}

View file

@ -1,26 +0,0 @@
{
generic_workers_upstream.servers = {
"127.0.0.1:8008" = { };
};
stream_writer_typing_stream_workers_upstream.servers = {
"127.0.0.1:8008" = { };
};
stream_writer_to_device_stream_workers_upstream.servers = {
"127.0.0.1:8008" = { };
};
stream_writer_account_data_stream_workers_upstream.servers = {
"127.0.0.1:8008" = { };
};
stream_writer_receipts_stream_workers_upstream.servers = {
"127.0.0.1:8008" = { };
};
stream_writer_presence_stream_workers_upstream.servers = {
"127.0.0.1:8008" = { };
};
media_repository_workers_upstream.servers = {
"127.0.0.1:8008" = { };
};
user_dir_workers_upstream.servers = {
"127.0.0.1:8008" = { };
};
}

View file

@ -89,5 +89,11 @@
hardware.pulseaudio.enable = false;
# This shaves off half a gigabyte of disk space...
hardware.enableAllFirmware = false;
hardware.enableRedistributableFirmware = false;
services.lvm.enable = false;
i18n.defaultLocale = "en_US.UTF-8";
}

View file

@ -33,8 +33,6 @@
"net.core.wmem_default=1048576"
"net.core.wmem_max=16777216"
"net.core.optmem_max=65536"
#"net.ipv4.tcp_rmem=4096 1048576 2097152"
#"net.ipv4.tcp_wmem=4096 65536 16777216"
"net.ipv4.udp_rmem_min=4096"
"net.ipv4.udp_wmem_min=4096"
"net.ipv4.tcp_fastopen=3"
@ -94,7 +92,6 @@
};
environment.systemPackages = with pkgs; [
wget
neofetch
lnav
pciutils
@ -105,17 +102,11 @@
btop
duf
kitty.terminfo
tmux
jq
yq
pv
dig
cloud-utils
nix-output-monitor
expect
unrar-wrapper
arch-install-scripts
debootstrap
file
unzip
brotli

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,53 @@
{
config,
lib,
pkgs,
...
}:
{
options.services.ooye = {
enable = lib.mkEnableOption "Enable the Ooye service";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.callPackage ../packages/package.nix { };
description = ''
The Ooye package.
'';
};
#discordAccessTokenFile = lib.mkOption {
# type = lib.types.path;
# default = "/etc/ooye/discord-access-token";
# description = ''
# The path to the file containing the Discord access token.
# '';
#};
##yaml
#matrixHomeserverConfig = lib.mkOption {
# types = lib.types.submodule;
# homeserverTokenFile = lib.mkOption {
# type = lib.types.path;
# default = "/etc/matrix/homeserver-token";
# description = ''
# The path to the file containing the Matrix homeserver token.
# '';
# };
# appserviceTokenFile = lib.mkOption {
# type = lib.types.path;
# default = "/etc/matrix/appservice-token";
# description = ''
# The path to the file containing the Matrix appservice token.
# '';
# };
#
#};
};
config = lib.mkIf (config.services.ooye.enable) {
systemd.services."ooye.service" = {
enable = true;
serviceConfig = {
ExecStart = "${config.services.ooye.package}/bin/ooye";
};
};
};
}

View file

@ -0,0 +1,31 @@
{
lib,
fetchgit,
makeWrapper,
nodejs,
buildNpmPackage,
}:
buildNpmPackage rec {
pname = "out-of-your-element";
version = "0";
src = fetchgit {
url = "https://gitdab.com/cadence/out-of-your-element.git";
sha256 = "K9myaHmCTRQEHmOUmRj0f/51GgQyPl7mNBtBhe3rUMw=";
};
npmDepsHash = "sha256-Ujo+qz3HiHMNUhbiYiSp5Z6khVqzXL4ayvxXERwdsG4=";
makeCacheWritable = true; # Something tries to write there, idk why - Emma [it/its] @ Rory&
nativeBuildInputs = [ makeWrapper ];
meta = with lib; {
description = "A Matrix Discord bridge";
homepage = "https://gitdab.com/cadence/out-of-your-element";
longDescription = ''
Cool.
'';
#license = licenses.agpl3;
#maintainers = with maintainers; [ RorySys ];
mainProgram = "null";
};
}

View file

@ -20,6 +20,7 @@
" your custom vimrc
set nocompatible
set backspace=indent,eol,start
colorscheme vim
" ...
'';
};