diff --git a/configurations/camelot/default.nix b/configurations/camelot/default.nix index 29bf2d3..d0383de 100644 --- a/configurations/camelot/default.nix +++ b/configurations/camelot/default.nix @@ -53,6 +53,8 @@ }; }; + my.server.mollysocket.enable = true; + my.users = { dala = { description = "Dala"; diff --git a/flake.lock b/flake.lock index 3450e4b..193489d 100644 --- a/flake.lock +++ b/flake.lock @@ -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": { diff --git a/modules/server/default.nix b/modules/server/default.nix index 14d81f4..9c49d4d 100644 --- a/modules/server/default.nix +++ b/modules/server/default.nix @@ -3,5 +3,6 @@ ../common ./network.nix ./nginx.nix + ./mollysocket.nix ]; } diff --git a/modules/server/mollysocket.nix b/modules/server/mollysocket.nix new file mode 100644 index 0000000..ed54d3a --- /dev/null +++ b/modules/server/mollysocket.nix @@ -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}"; + }; + }; + }; +}