mirror of
https://git.lgmrszd.xyz/Lgmrszd/nix-cfg.git
synced 2025-12-14 07:38:19 +01:00
Local akkoma for testing
This commit is contained in:
parent
b317cd7865
commit
85654ce3a9
8 changed files with 361 additions and 17 deletions
30
hosts/laptop/akkoma/akkoma-static.nix
Normal file
30
hosts/laptop/akkoma/akkoma-static.nix
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
{ pkgs, config, lib, ... }:
|
||||
let
|
||||
imperativeStaticPath = "/data/akkoma/static_i";
|
||||
declarativeStaticPath = "/data/akkoma/static_d";
|
||||
mergedStaticPath = "/data/akkoma/static";
|
||||
declarativeStaticFiles = let cfg = config.services.akkoma; in with lib; pkgs.runCommandLocal "declarative-akkoma-static" { } ''
|
||||
${concatStringsSep "\n" (mapAttrsToList (key: val: ''
|
||||
mkdir -p $out/frontends/${escapeShellArg val.name}/
|
||||
ln -s ${escapeShellArg val.package} $out/frontends/${escapeShellArg val.name}/${escapeShellArg val.ref}
|
||||
'') cfg.frontends)}
|
||||
|
||||
${optionalString (cfg.extraStatic != null)
|
||||
(concatStringsSep "\n" (mapAttrsToList (key: val: ''
|
||||
mkdir -p "$out/$(dirname ${escapeShellArg key})"
|
||||
ln -s ${escapeShellArg val} $out/${escapeShellArg key}
|
||||
'') cfg.extraStatic))}
|
||||
'';
|
||||
in
|
||||
{
|
||||
environment.systemPackages = with pkgs; [ mergerfs ];
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${imperativeStaticPath} 700 akkoma akkoma -"
|
||||
"L+ ${declarativeStaticPath} - - - - ${toString declarativeStaticFiles}"
|
||||
];
|
||||
fileSystems."${mergedStaticPath}" = {
|
||||
fsType = "fuse.mergerfs";
|
||||
device = "${imperativeStaticPath}:${declarativeStaticPath}";
|
||||
options = [ "cache.files=off" "dropcacheonclose=true" "category.create=epff" ];
|
||||
};
|
||||
}
|
||||
53
hosts/laptop/akkoma/akkoma.nix
Normal file
53
hosts/laptop/akkoma/akkoma.nix
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
{ pkgs, lib, config, ... }:
|
||||
let
|
||||
inherit ((pkgs.formats.elixirConf {}).lib) mkMap mkAtom mkRaw mkTuple;
|
||||
in
|
||||
{
|
||||
services.akkoma = {
|
||||
enable = true;
|
||||
initSecrets = false;
|
||||
patches.configurableFromDatabase = true;
|
||||
# frontends.mastodon = {
|
||||
# package = ;
|
||||
# name = "mastodon-fe";
|
||||
# ref = "stable";
|
||||
# };
|
||||
extraPackages = with pkgs; [ zip unzip exiftool ffmpeg_5-headless graphicsmagick-imagemagick-compat ];
|
||||
config = {
|
||||
":pleroma".":instance" = {
|
||||
name = "My Akkoma instance";
|
||||
description = "Akkoma instance description";
|
||||
email = "user@localhost";
|
||||
registration_open = false;
|
||||
federating = false;
|
||||
upload_dir = "/data/uploads";
|
||||
static_dir = "/data/akkoma/static";
|
||||
};
|
||||
":pleroma"."Pleroma.Web.Endpoint" = {
|
||||
url.host = config.myAkkomaContainerOptions.domain;
|
||||
http.ip = config.myAkkomaContainerOptions.localAddress;
|
||||
http.port = config.myAkkomaContainerOptions.localPort;
|
||||
};
|
||||
|
||||
":pleroma"."Pleroma.Uploaders.Local".uploads = "/data/uploads";
|
||||
|
||||
":pleroma".":mrf".policies = map mkRaw [
|
||||
"Pleroma.Web.ActivityPub.MRF.ObjectAgePolicy"
|
||||
"Pleroma.Web.ActivityPub.MRF.TagPolicy"
|
||||
"Pleroma.Web.ActivityPub.MRF.SimplePolicy"
|
||||
];
|
||||
":pleroma".":mrf_simple".accept = [
|
||||
(mkTuple ["good.instance" "good!"])
|
||||
];
|
||||
|
||||
|
||||
":pleroma"."Pleroma.Web.Endpoint".secret_key_base = { _secret = "/run/secrets/akkotest/key-base"; };
|
||||
":pleroma"."Pleroma.Web.Endpoint".signing_salt = { _secret = "/run/secrets/akkotest/signing-salt"; };
|
||||
":pleroma"."Pleroma.Web.Endpoint".live_view.signing_salt = { _secret = "/run/secrets/akkotest/liveview-salt"; };
|
||||
":web_push_encryption".":vapid_details".private_key = { _secret = "/run/secrets/akkotest/vapid-private"; };
|
||||
":web_push_encryption".":vapid_details".public_key = { _secret = "/run/secrets/akkotest/vapid-public"; };
|
||||
":joken".":default_signer" = { _secret = "/run/secrets/akkotest/jwt-signer"; };
|
||||
|
||||
};
|
||||
};
|
||||
}
|
||||
45
hosts/laptop/akkoma/akkontainer.nix
Normal file
45
hosts/laptop/akkoma/akkontainer.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
cfg = config.myAkkomaContainerOptions;
|
||||
in
|
||||
with lib;
|
||||
{
|
||||
options.myAkkomaContainerOptions = {
|
||||
enable = mkEnableOption "akkoma container tweaks";
|
||||
hostAddress = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
localAddress = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
localPort = mkOption {
|
||||
type = types.int;
|
||||
};
|
||||
domain = mkOption {
|
||||
type = types.str;
|
||||
};
|
||||
isContainer = mkOption {
|
||||
type = types.uniq types.bool;
|
||||
default = false;
|
||||
};
|
||||
containerName = mkOption {
|
||||
type = types.uniq types.str;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
config = mkIf (cfg.enable && (!cfg.isContainer)) {
|
||||
containers.${cfg.containerName}.config =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
myAkkomaContainerOptions = with cfg; {
|
||||
isContainer = true;
|
||||
inherit hostAddress;
|
||||
inherit localAddress;
|
||||
inherit localPort;
|
||||
inherit domain;
|
||||
# inherit containerName;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue