Add workers with matrix-synapse-next, various fixes and updates
This commit is contained in:
parent
1cb1c887d9
commit
13fcdfa9a9
34
flake.lock
34
flake.lock
|
@ -21,6 +21,24 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"matrix-synapse-next": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1690488646,
|
||||||
|
"narHash": "sha256-yuceqT8Ev1sdwYvGYHegdTo0yrdRxVYJ2qXSbPtBgTw=",
|
||||||
|
"owner": "dali99",
|
||||||
|
"repo": "nixos-matrix-modules",
|
||||||
|
"rev": "bf997073d98670528c6230144e208a37d27fc388",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "dali99",
|
||||||
|
"repo": "nixos-matrix-modules",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nix-darwin": {
|
"nix-darwin": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
|
@ -58,6 +76,21 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs-lib": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1673743903,
|
||||||
|
"narHash": "sha256-sloY6KYyVOozJ1CkbgJPpZ99TKIjIvM+04V48C04sMQ=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"rev": "7555e2dfcbac1533f047021f1744ac8871150f9f",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "nixpkgs.lib",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs-stable": {
|
"nixpkgs-stable": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1691874659,
|
"lastModified": 1691874659,
|
||||||
|
@ -77,6 +110,7 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"home-manager": "home-manager",
|
"home-manager": "home-manager",
|
||||||
|
"matrix-synapse-next": "matrix-synapse-next",
|
||||||
"nix-darwin": "nix-darwin",
|
"nix-darwin": "nix-darwin",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"sops-nix": "sops-nix",
|
"sops-nix": "sops-nix",
|
||||||
|
|
13
flake.nix
13
flake.nix
|
@ -11,11 +11,21 @@
|
||||||
home-manager.url = "github:nix-community/home-manager/release-23.05";
|
home-manager.url = "github:nix-community/home-manager/release-23.05";
|
||||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
matrix-synapse-next.url = "github:dali99/nixos-matrix-modules";
|
||||||
|
|
||||||
sops-nix.url = "github:Mic92/sops-nix";
|
sops-nix.url = "github:Mic92/sops-nix";
|
||||||
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
|
sops-nix.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, unstable, home-manager, nix-darwin, sops-nix, ... }@inputs:
|
outputs = {
|
||||||
|
self
|
||||||
|
, nixpkgs
|
||||||
|
, unstable
|
||||||
|
, nix-darwin
|
||||||
|
, home-manager
|
||||||
|
, matrix-synapse-next
|
||||||
|
, sops-nix
|
||||||
|
, ... }@inputs:
|
||||||
let
|
let
|
||||||
overlay-unstable = final: prev: {
|
overlay-unstable = final: prev: {
|
||||||
unstable = unstable.legacyPackages.${prev.system};
|
unstable = unstable.legacyPackages.${prev.system};
|
||||||
|
@ -34,6 +44,7 @@
|
||||||
|
|
||||||
./hosts/voyager/configuration.nix
|
./hosts/voyager/configuration.nix
|
||||||
sops-nix.nixosModules.sops
|
sops-nix.nixosModules.sops
|
||||||
|
matrix-synapse-next.nixosModules.synapse
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
chapel = nixpkgs.lib.nixosSystem {
|
chapel = nixpkgs.lib.nixosSystem {
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
./services/vaultwarden.nix
|
./services/vaultwarden.nix
|
||||||
./services/calibre.nix
|
./services/calibre.nix
|
||||||
./services/stash.nix
|
./services/stash.nix
|
||||||
|
./services/fancontrol.nix
|
||||||
# ./services/code-server.nix
|
# ./services/code-server.nix
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
{ config, lib, pkgs, ... }:
|
{ config, lib, pkgs, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
domain = "books.home.feal.no";
|
domain = "books.home.feal.no";
|
||||||
storage = "/tank/media/books";
|
storage = "/tank/media/books";
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
{ config, lib, pkgs, ... }:
|
||||||
|
{
|
||||||
|
systemd.timers."fancontrol" = {
|
||||||
|
wantedBy = [ "timers.target" ];
|
||||||
|
timerConfig = {
|
||||||
|
OnCalendar="*:0/3";
|
||||||
|
Unit = "fancontrol.service";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
systemd.services."fancontrol" = {
|
||||||
|
environment = {
|
||||||
|
TEMP_MIN_FALLING = "50";
|
||||||
|
TEMP_MAX_RISING = "56";
|
||||||
|
TEMP_CRIT = "70";
|
||||||
|
|
||||||
|
LOW_FAN_SPEED = "0x10";
|
||||||
|
};
|
||||||
|
|
||||||
|
script = ''
|
||||||
|
SET_FAN_MANUAL="0x30 0x30 0x01 0x00" # Enable manual control
|
||||||
|
SET_FAN_AUTO="0x30 0x30 0x01 0x01" # Disable manual control
|
||||||
|
|
||||||
|
SET_FAN_LOW="0x30 0x30 0x02 0xff $LOW_FAN_SPEED"
|
||||||
|
SET_FAN_MAX="0x30 0x30 0x02 0xff 0x64" # force 100%
|
||||||
|
|
||||||
|
|
||||||
|
# Get all temperatures readings starting with "Temp ", find all two digit numbers followed by spaces, find the largest one, trim the trailing space
|
||||||
|
maxcoretemp=$(${pkgs.ipmitool}/bin/ipmitool sdr type temperature | grep '^Temp ' | grep -Po '\d{2} ' | sort -nr | head -n1 | xargs)
|
||||||
|
|
||||||
|
# Verify that we read a valid number
|
||||||
|
ISNUMBER='^[0-9]+$'
|
||||||
|
if ! [[ $maxcoretemp =~ $ISNUMBER ]] ; then
|
||||||
|
echo "Error: could not read temperature" >&2
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Highest measured CPU temperature: '$maxcoretemp'"
|
||||||
|
|
||||||
|
if [ "$maxcoretemp" -gt "$TEMP_CRIT" ]; then
|
||||||
|
echo "TOO HOT, CRITICAL CPU TEMP"
|
||||||
|
${pkgs.ipmitool}/bin/ipmitool raw $SET_FAN_MANUAL
|
||||||
|
${pkgs.ipmitool}/bin/ipmitool raw $SET_FAN_MAX
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$maxcoretemp" -gt "$TEMP_MAX_RISING" ]; then
|
||||||
|
echo "TOO HOT, switching to IDRAC fan controL"
|
||||||
|
${pkgs.ipmitool}/bin/ipmitool raw $SET_FAN_AUTO
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$maxcoretemp" -lt "$TEMP_MIN_FALLING" ]; then
|
||||||
|
echo "Sufficiently cooled, stepping down fans"
|
||||||
|
${pkgs.ipmitool}/bin/ipmitool raw $SET_FAN_MANUAL
|
||||||
|
${pkgs.ipmitool}/bin/ipmitool raw $SET_FAN_LOW
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Temperature is between limits, doing nothing..."
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
|
@ -3,7 +3,7 @@ let
|
||||||
cfg = config.services.gitea;
|
cfg = config.services.gitea;
|
||||||
domain = "git.feal.no";
|
domain = "git.feal.no";
|
||||||
httpPort = 3004;
|
httpPort = 3004;
|
||||||
/* sshPort = 2222; */
|
sshPort = 2222;
|
||||||
in {
|
in {
|
||||||
services.gitea = {
|
services.gitea = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
@ -17,7 +17,7 @@ in {
|
||||||
server = {
|
server = {
|
||||||
LANDING_PAGE=''"/felixalb"'';
|
LANDING_PAGE=''"/felixalb"'';
|
||||||
HTTP_PORT = httpPort;
|
HTTP_PORT = httpPort;
|
||||||
/* SSH_PORT = sshPort; */
|
SSH_PORT = sshPort;
|
||||||
SSH_DOMAIN = "voyager.home.feal.no";
|
SSH_DOMAIN = "voyager.home.feal.no";
|
||||||
DOMAIN = domain;
|
DOMAIN = domain;
|
||||||
ROOT_URL = "https://${domain}";
|
ROOT_URL = "https://${domain}";
|
||||||
|
@ -51,6 +51,5 @@ in {
|
||||||
# - configure mailer
|
# - configure mailer
|
||||||
};
|
};
|
||||||
|
|
||||||
/* networking.firewall.allowedTCPPorts = [ httpPort sshPort ]; */
|
networking.firewall.allowedTCPPorts = [ httpPort sshPort ];
|
||||||
networking.firewall.allowedTCPPorts = [ httpPort ];
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config, pkgs, ... }:
|
{ config, pkgs, lib, ... }:
|
||||||
let
|
let
|
||||||
main_ip = "127.0.1.2";
|
main_ip = "127.0.1.2";
|
||||||
in
|
in
|
||||||
|
@ -9,9 +9,19 @@ in
|
||||||
group = "matrix-synapse";
|
group = "matrix-synapse";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.matrix-synapse = {
|
services.matrix-synapse-next = {
|
||||||
enable = true;
|
enable = true;
|
||||||
package = pkgs.matrix-synapse;
|
enableNginx = true;
|
||||||
|
|
||||||
|
workers = {
|
||||||
|
federationSenders = 1;
|
||||||
|
federationReceivers = 2;
|
||||||
|
initialSyncers = 1;
|
||||||
|
normalSyncers = 1;
|
||||||
|
eventPersisters = 1;
|
||||||
|
useUserDirectoryWorker = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
extraConfigFiles = [
|
extraConfigFiles = [
|
||||||
config.sops.secrets."matrix/synapse/registrationsecret".path
|
config.sops.secrets."matrix/synapse/registrationsecret".path
|
||||||
|
@ -63,42 +73,50 @@ in
|
||||||
tls_certificate_path = "/etc/ssl-snakeoil/matrix_feal_no.crt";
|
tls_certificate_path = "/etc/ssl-snakeoil/matrix_feal_no.crt";
|
||||||
tls_private_key_path = "/etc/ssl-snakeoil/matrix_feal_no.key";
|
tls_private_key_path = "/etc/ssl-snakeoil/matrix_feal_no.key";
|
||||||
|
|
||||||
listeners = [
|
/* listeners = [ */
|
||||||
{ port = 8008;
|
/* { port = 8008; */
|
||||||
bind_addresses = [ main_ip ];
|
/* bind_addresses = [ main_ip ]; */
|
||||||
type = "http";
|
/* type = "http"; */
|
||||||
tls = false;
|
/* tls = false; */
|
||||||
x_forwarded = true;
|
/* x_forwarded = true; */
|
||||||
resources = [
|
/* resources = [ */
|
||||||
{ names = [ "client" ]; compress = true; }
|
/* { names = [ "client" ]; compress = true; } */
|
||||||
{ names = [ "federation" ]; compress = true; }
|
/* { names = [ "federation" ]; compress = true; } */
|
||||||
];
|
/* ]; */
|
||||||
}
|
/* } */
|
||||||
];
|
/* ]; */
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
services.redis.servers."".enable = true;
|
||||||
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
networking.firewall.allowedTCPPorts = [ 80 443 ];
|
||||||
|
|
||||||
services.nginx = {
|
services.nginx.virtualHosts."matrix.feal.no" = {
|
||||||
enable = true;
|
enableACME = lib.mkForce false;
|
||||||
enableReload = true;
|
forceSSL = lib.mkForce false;
|
||||||
|
/* sslCertificate = "/etc/ssl-snakeoil/matrix_feal_no.crt"; */
|
||||||
|
/* sslKey = "/etc/ssl-snakeoil/matrix_feal_no.key"; */
|
||||||
|
};
|
||||||
|
|
||||||
recommendedOptimisation = true;
|
/* services.nginx = { */
|
||||||
recommendedGzipSettings = true;
|
/* enable = true; */
|
||||||
recommendedProxySettings = true;
|
/* enableReload = true; */
|
||||||
|
|
||||||
virtualHosts."matrix.feal.no" = {
|
/* recommendedOptimisation = true; */
|
||||||
locations."/_matrix" = {
|
/* recommendedGzipSettings = true; */
|
||||||
proxyPass = "http://${main_ip}:8008";
|
/* recommendedProxySettings = true; */
|
||||||
extraConfig = ''
|
|
||||||
client_max_body_size 50M;
|
/* virtualHosts."matrix.feal.no" = { */
|
||||||
'';
|
/* locations."/_matrix" = { */
|
||||||
};
|
/* proxyPass = "http://${main_ip}:8008"; */
|
||||||
# locations."/_synapse/client".proxyPass = "http://${main_ip}:8008";
|
/* extraConfig = '' */
|
||||||
locations."/" = {
|
/* client_max_body_size 50M; */
|
||||||
proxyPass = "http://${main_ip}:8008";
|
/* ''; */
|
||||||
};
|
/* }; */
|
||||||
};
|
/* # locations."/_synapse/client".proxyPass = "http://${main_ip}:8008"; */
|
||||||
};
|
/* locations."/" = { */
|
||||||
|
/* proxyPass = "http://${main_ip}:8008"; */
|
||||||
|
/* }; */
|
||||||
|
/* }; */
|
||||||
|
/* }; */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue