Mix of lots of shit
This commit is contained in:
parent
bab13c6d35
commit
0e42173d73
|
@ -1,3 +1,5 @@
|
||||||
|
arion:
|
||||||
|
|
||||||
{ config, lib, pkgs, ... }@toplevel:
|
{ config, lib, pkgs, ... }@toplevel:
|
||||||
|
|
||||||
with lib;
|
with lib;
|
||||||
|
@ -6,26 +8,76 @@ let
|
||||||
|
|
||||||
hostSecrets = config.fudo.secrets.host-secrets."${config.instance.hostname}";
|
hostSecrets = config.fudo.secrets.host-secrets."${config.instance.hostname}";
|
||||||
|
|
||||||
lemmyDockerImage = { hostname, lemmyDockerImage, lemmyUiDockerImage
|
lemmyImage = { hostname, port, lemmyCfgFile, nginxCfgFile, postgresCfgFile
|
||||||
, nginxCfgFile, pictrsApiKey, pictrsDockerImage, port, postgresDockerImage
|
, lemmyDockerImage, lemmyUiDockerImage, pictrsDockerImage
|
||||||
, postgresCfg, postgresPasswd, smtpServer, stateDirectory, ... }:
|
, postgresDockerImage, stateDirectory, ... }:
|
||||||
let
|
{ pkgs, ... }: {
|
||||||
lemmyCfgFile =
|
project.name = "lemmy";
|
||||||
lemmyCfg { inherit hostname postgresPasswd pictrsApiKey smtpServer; };
|
services = {
|
||||||
lemmyDockerComposeCfgDir = lemmyDockerComposeCfg {
|
proxy = {
|
||||||
inherit hostname port lemmyCfgFile nginxCfgFile pictrsApiKey
|
service = {
|
||||||
stateDirectory postgresPasswd lemmyDockerImage lemmyUiDockerImage
|
image = "nginx:1-alpine";
|
||||||
pictrsDockerImage postgresDockerImage postgresCfg;
|
ports = [ "${port}:8536" ];
|
||||||
|
volumes = [ "${nginxCfgFile}:/etc/nginx/nginx.conf:ro,Z" ];
|
||||||
|
depends_on = [ "pictrs" "lemmy-ui" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
lemmy = {
|
||||||
|
service = {
|
||||||
|
image = lemmyDockerImage;
|
||||||
|
hostname = "lemmy";
|
||||||
|
environment.RUST_LOG = "warn";
|
||||||
|
volumes = [ "${lemmyCfgFile}:/config/config.hjson:ro,Z" ];
|
||||||
|
depends_on = [ "postgres" "pictrs" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
lemmy-ui = {
|
||||||
|
service = {
|
||||||
|
image = lemmyUiDockerImage;
|
||||||
|
hostname = "lemmy-ui";
|
||||||
|
environment = {
|
||||||
|
LEMMY_UI_LEMMY_INTERNAL_HOST = "lemmy:8536";
|
||||||
|
LEMMY_UI_LEMMY_EXTERNAL_HOST = hostname;
|
||||||
|
LEMMY_UI_HTTPS = true;
|
||||||
|
};
|
||||||
|
depends_on = [ "lemmy" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
pictrs = {
|
||||||
|
service = {
|
||||||
|
image = pictrsDockerImage;
|
||||||
|
hostname = "pictrs";
|
||||||
|
environment = {
|
||||||
|
PICTRS_OPENTELEMETRY_URL = "http://otel:4137";
|
||||||
|
PICTRS__API_KEY = "pictrsApiKey";
|
||||||
|
RUST_LOG = "debug";
|
||||||
|
RUST_BACKTRACE = "full";
|
||||||
|
PICTRS__MEDIA__VIDEO_CODEC = "vp9";
|
||||||
|
PICTRS__MEDIA__GIF__MAX_WIDTH = "256";
|
||||||
|
PICTRS__MEDIA__GIF__MAX_HEIGHT = "256";
|
||||||
|
PICTRS__MEDIA__GIF__MAX_AREA = "65536";
|
||||||
|
PICTRS__MEDIA__GIF__MAX_FRAME_COUNT = "400";
|
||||||
|
};
|
||||||
|
volumes = [ "${stateDirectory}/pictrs:/mnt:Z" ];
|
||||||
|
service.user = "991:991";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
postgres = {
|
||||||
|
service = {
|
||||||
|
image = postgresDockerImage;
|
||||||
|
hostname = "postgres";
|
||||||
|
environment = {
|
||||||
|
POSTGRES_USER = "lemmy";
|
||||||
|
POSTGRES_PASSWORD = postgresPassword;
|
||||||
|
POSTGRES_DB = "lemmy";
|
||||||
|
};
|
||||||
|
volumes = [
|
||||||
|
"${stateDirectory}/postgres:/var/lib/postgresql/data:Z"
|
||||||
|
"${postgresCfg}:/etc/postgresql.conf"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in pkgs.stdenv.mkDerivation {
|
|
||||||
name = "lemmy-docker-image";
|
|
||||||
src = lemmyDockerComposeCfgDir;
|
|
||||||
buildInputs = with pkgs; [ docker-compose ];
|
|
||||||
buildPhase = "docker-compose build";
|
|
||||||
installPhase = ''
|
|
||||||
ls
|
|
||||||
exit 1
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
|
|
||||||
nginxCfgFile = pkgs.writeText "lemmy-nginx.conf" ''
|
nginxCfgFile = pkgs.writeText "lemmy-nginx.conf" ''
|
||||||
|
@ -263,6 +315,8 @@ in {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
imports = [ arion.nixosModule.arion ];
|
||||||
|
|
||||||
config = mkIf cfg.enable (let
|
config = mkIf cfg.enable (let
|
||||||
postgresPasswd =
|
postgresPasswd =
|
||||||
readFile (pkgs.lib.passwd.random-passwd-file "lemmy-postgres-passwd" 30);
|
readFile (pkgs.lib.passwd.random-passwd-file "lemmy-postgres-passwd" 30);
|
||||||
|
@ -280,6 +334,13 @@ in {
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualisation = {
|
virtualisation = {
|
||||||
|
arion = {
|
||||||
|
backend = "podman-socket";
|
||||||
|
projects.lemmy.settings = {
|
||||||
|
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
oci-containers.containers.lemmy = {
|
oci-containers.containers.lemmy = {
|
||||||
# Not sure what the image should be...
|
# Not sure what the image should be...
|
||||||
image = "lemmy/lemmy";
|
image = "lemmy/lemmy";
|
||||||
|
|
Loading…
Reference in New Issue