nixfiles/hosts/koi/containers/sharkey/default.nix

81 lines
2 KiB
Nix
Raw Normal View History

2024-01-08 07:49:51 +03:00
{ abs, pkgs, ... }@inputs:
let
UID = 1104;
trivial = import (abs "lib/trivial.nix") inputs;
context = trivial.storeDirectory ./.;
in {
users.users.misskey = {
isNormalUser = true;
uid = UID;
};
2024-01-08 07:49:51 +03:00
systemd.tmpfiles.rules = [
"d /srv/Sharkey 0777 root root -"
2024-01-08 07:49:51 +03:00
];
services.postgresql.ensureUsers = [
{ name = "misskey"; ensureDBOwnership = true; }
];
services.postgresql.ensureDatabases = [ "misskey" ];
desu.postgresql.ensurePasswords.misskey = "misskey";
virtualisation.oci-containers.containers.sharkey-redis = {
image = "docker.io/redis:7.0-alpine";
volumes = [
"/srv/Sharkey/redis:/data"
];
user = builtins.toString UID;
};
virtualisation.oci-containers.containers.sharkey-meili = {
image = "getmeili/meilisearch:v1.3.4";
volumes = [
"/srv/Sharkey/meili_data:/meili_data"
];
environment = {
MEILI_NO_ANALYTICS = "true";
MEILI_ENV = "production";
MEILI_MASTER_KEY = "misskeymeilisearch";
};
user = builtins.toString UID;
};
# not really reproducible but fuck it i figured it's the best way lol.
# im **not** rewriting that 100 lines dockerfile
systemd.services.docker-sharkey.serviceConfig.ExecStartPre = [
(pkgs.writeShellScript "build-sharkey" ''
docker build -t local/sharkey ${context}
'')
];
systemd.services.docker-sharkey.after = [ "postgresql.service" ];
virtualisation.oci-containers.containers.sharkey = {
dependsOn = [ "sharkey-redis" "sharkey-meili" ];
image = "local/sharkey";
volumes = [
2024-11-13 22:56:04 +03:00
"/srv/Sharkey/files:/sharkey/files"
"${context}/.config:/sharkey/.config:ro"
];
environment = {
NODE_ENV = "production";
};
user = builtins.toString UID;
};
2024-01-08 07:49:51 +03:00
services.nginx.virtualHosts."very.stupid.fish" = {
forceSSL = true;
useACMEHost = "stupid.fish";
2024-05-17 14:24:35 +03:00
http2 = true;
2024-01-08 07:49:51 +03:00
extraConfig = ''
client_max_body_size 250M;
'';
2024-01-08 07:49:51 +03:00
locations."/" = {
proxyPass = "http://sharkey.docker$request_uri";
2024-01-08 07:49:51 +03:00
proxyWebsockets = true;
};
};
}