chore: move cinny to a different file
All checks were successful
Flake checker / Build Nix targets (push) Successful in 9m24s
All checks were successful
Flake checker / Build Nix targets (push) Successful in 9m24s
This commit is contained in:
71
nixos/tako/services/matrix/cinny.nix
Normal file
71
nixos/tako/services/matrix/cinny.nix
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
config,
|
||||||
|
...
|
||||||
|
}: let
|
||||||
|
base_domain = "darksailor.dev";
|
||||||
|
cinnyConfig = builtins.toJSON {
|
||||||
|
defaultHomeserver = 0;
|
||||||
|
homeserverList = ["darksailor.dev" "matrix.org"];
|
||||||
|
allowCustomHomeservers = false;
|
||||||
|
hashRouter = {
|
||||||
|
enabled = true;
|
||||||
|
basename = "/";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
cinnyConfigFile = pkgs.writeText "cinny-config.json" cinnyConfig;
|
||||||
|
cinny = with pkgs;
|
||||||
|
buildNpmPackage rec {
|
||||||
|
pname = "cinny-unwrapped";
|
||||||
|
version = "4.10.5";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "cinnyapp";
|
||||||
|
repo = "cinny";
|
||||||
|
tag = "v${version}";
|
||||||
|
hash = "sha256-Napy3AcsLRDZPcBh3oq1U30FNtvoNtob0+AZtZSvcbM=";
|
||||||
|
};
|
||||||
|
|
||||||
|
nodejs = nodejs_22;
|
||||||
|
|
||||||
|
npmDepsHash = "sha256-2Lrd0jAwAH6HkwLHyivqwaEhcpFAIALuno+MchSIfxo=";
|
||||||
|
|
||||||
|
nativeBuildInputs = [
|
||||||
|
python3
|
||||||
|
pkg-config
|
||||||
|
];
|
||||||
|
|
||||||
|
buildInputs =
|
||||||
|
[
|
||||||
|
pixman
|
||||||
|
cairo
|
||||||
|
pango
|
||||||
|
]
|
||||||
|
++ lib.optionals stdenv.hostPlatform.isDarwin [giflib];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
|
cp -r dist $out
|
||||||
|
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
in {
|
||||||
|
services.caddy.virtualHosts = {
|
||||||
|
"matrix.${base_domain}".extraConfig = ''
|
||||||
|
handle /_matrix/* {
|
||||||
|
reverse_proxy /_matrix/* localhost:${toString (builtins.elemAt config.services.matrix-tuwunel.settings.global.port 0)}
|
||||||
|
}
|
||||||
|
handle_path /config.json {
|
||||||
|
file_server
|
||||||
|
root ${cinnyConfigFile}
|
||||||
|
}
|
||||||
|
handle {
|
||||||
|
root * ${cinny}
|
||||||
|
try_files {path} /index.html
|
||||||
|
file_server
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{...}: {
|
{...}: {
|
||||||
imports = [
|
imports = [
|
||||||
./tuwunel.nix
|
./tuwunel.nix
|
||||||
# ./signal.nix // libolm deprecated
|
# ./signal.nix
|
||||||
# ./discord.nix
|
# ./discord.nix
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,53 +8,6 @@
|
|||||||
client_id = "tuwunel";
|
client_id = "tuwunel";
|
||||||
rtc_domain = "matrix-rtc.${base_domain}";
|
rtc_domain = "matrix-rtc.${base_domain}";
|
||||||
jwt_port = 8081;
|
jwt_port = 8081;
|
||||||
cinnyConfig = builtins.toJSON {
|
|
||||||
defaultHomeserver = 0;
|
|
||||||
homeserverList = ["darksailor.dev" "matrix.org"];
|
|
||||||
allowCustomHomeservers = false;
|
|
||||||
hashRouter = {
|
|
||||||
enabled = true;
|
|
||||||
basename = "/";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
cinnyConfigFile = pkgs.writeText "cinny-config.json" cinnyConfig;
|
|
||||||
cinny = with pkgs;
|
|
||||||
buildNpmPackage rec {
|
|
||||||
pname = "cinny-unwrapped";
|
|
||||||
version = "4.10.5";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "cinnyapp";
|
|
||||||
repo = "cinny";
|
|
||||||
tag = "v${version}";
|
|
||||||
hash = "sha256-Napy3AcsLRDZPcBh3oq1U30FNtvoNtob0+AZtZSvcbM=";
|
|
||||||
};
|
|
||||||
|
|
||||||
nodejs = nodejs_22;
|
|
||||||
|
|
||||||
npmDepsHash = "sha256-2Lrd0jAwAH6HkwLHyivqwaEhcpFAIALuno+MchSIfxo=";
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
|
||||||
python3
|
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
|
|
||||||
buildInputs =
|
|
||||||
[
|
|
||||||
pixman
|
|
||||||
cairo
|
|
||||||
pango
|
|
||||||
]
|
|
||||||
++ lib.optionals stdenv.hostPlatform.isDarwin [giflib];
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
runHook preInstall
|
|
||||||
|
|
||||||
cp -r dist $out
|
|
||||||
|
|
||||||
runHook postInstall
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
in {
|
in {
|
||||||
sops = {
|
sops = {
|
||||||
secrets."tuwunel/client_id" = {
|
secrets."tuwunel/client_id" = {
|
||||||
@@ -108,20 +61,20 @@ in {
|
|||||||
package = pkgs.matrix-tuwunel;
|
package = pkgs.matrix-tuwunel;
|
||||||
};
|
};
|
||||||
services.caddy.virtualHosts = {
|
services.caddy.virtualHosts = {
|
||||||
"matrix.${base_domain}".extraConfig = ''
|
# "matrix.${base_domain}".extraConfig = ''
|
||||||
handle /_matrix/* {
|
# handle /_matrix/* {
|
||||||
reverse_proxy /_matrix/* localhost:${toString port}
|
# reverse_proxy /_matrix/* localhost:${toString port}
|
||||||
}
|
# }
|
||||||
handle_path /config.json {
|
# handle_path /config.json {
|
||||||
file_server
|
# file_server
|
||||||
root ${cinnyConfigFile}
|
# root ${cinnyConfigFile}
|
||||||
}
|
# }
|
||||||
handle {
|
# handle {
|
||||||
root * ${cinny}
|
# root * ${cinny}
|
||||||
try_files {path} /index.html
|
# try_files {path} /index.html
|
||||||
file_server
|
# file_server
|
||||||
}
|
# }
|
||||||
'';
|
# '';
|
||||||
"${base_domain}".extraConfig = ''
|
"${base_domain}".extraConfig = ''
|
||||||
reverse_proxy /.well-known/* localhost:${toString port}
|
reverse_proxy /.well-known/* localhost:${toString port}
|
||||||
'';
|
'';
|
||||||
|
|||||||
Reference in New Issue
Block a user