Add mollysocket server

This commit is contained in:
Victor Mignot 2024-09-01 09:12:53 +02:00
parent 2ee4bb3190
commit 61162547d9
Signed by: dala
GPG key ID: 5E7F2CE1BEAFED3D
4 changed files with 51 additions and 7 deletions

View file

@ -53,6 +53,8 @@
};
};
my.server.mollysocket.enable = true;
my.users = {
dala = {
description = "Dala";

View file

@ -23,11 +23,11 @@
},
"extra-config": {
"locked": {
"lastModified": 1725089963,
"narHash": "sha256-lUPSW3t46rJQThatY2nP/JoKZ9SSfeaIGfBh8srh4MU=",
"lastModified": 1725174688,
"narHash": "sha256-URQT2Vf8d3mAdP8ffbZ4j0fBtpXHyrD6rp4d3cSa0X8=",
"ref": "refs/heads/main",
"rev": "68fdf50688fed8fa37c2f28c279cdb22920b0afb",
"revCount": 6,
"rev": "41882ca7e4c0368af424f7bd98ab4b584228090f",
"revCount": 7,
"type": "git",
"url": "ssh://forgejo@git.dalaran.fr/dala/nixos-config-extra.git"
},
@ -346,11 +346,11 @@
},
"nixpkgs-stable_2": {
"locked": {
"lastModified": 1724855419,
"narHash": "sha256-WXHSyOF4nBX0cvHN3DfmEMcLOVdKH6tnMk9FQ8wTNRc=",
"lastModified": 1725001927,
"narHash": "sha256-eV+63gK0Mp7ygCR0Oy4yIYSNcum2VQwnZamHxYTNi+M=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ae2fc9e0e42caaf3f068c1bfdc11c71734125e06",
"rev": "6e99f2a27d600612004fbd2c3282d614bfee6421",
"type": "github"
},
"original": {

View file

@ -3,5 +3,6 @@
../common
./network.nix
./nginx.nix
./mollysocket.nix
];
}

View file

@ -0,0 +1,41 @@
{
lib,
config,
extraInfo,
...
}:
let
msConfig = config.services.mollysocket.settings;
in
with lib;
{
options.my.server.mollysocket.enable = mkOption {
type = types.bool;
default = false;
description = ''
Enable the mollysocket server, allowing UnifiedPush notifications for te Molly app.
'';
};
config = mkIf config.my.server.mollysocket.enable {
services.mollysocket = {
enable = true;
settings = {
allowed_uuids = [
extraInfo.signal.clientUuid
];
};
};
services.nginx.virtualHosts.${extraInfo.signal.notificationServerUri} = {
enableACME = true;
forceSSL = true;
locations."/" = {
recommendedProxySettings = true;
proxyWebsockets = true;
proxyPass = "http://${msConfig.host}:${builtins.toString msConfig.port}";
};
};
};
}