mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-28 02:56:13 +01:00
b6b9e09535
Signed-off-by: main <magic_rb@redalder.org>
37 lines
1.1 KiB
Nix
37 lines
1.1 KiB
Nix
{ nglib, nixpkgs }:
|
|
nglib.makeSystem {
|
|
system = "x86_64-linux";
|
|
name = "mautrix-facebook";
|
|
inherit nixpkgs;
|
|
config = ({ pkgs, ... }:
|
|
{
|
|
dumb-init = {
|
|
enable = true;
|
|
type.services = { };
|
|
};
|
|
|
|
init.services.mautrix-facebook = {
|
|
enabled = true;
|
|
shutdownOnExit = true;
|
|
script =
|
|
let
|
|
config = ./mautrix-facebook.yaml;
|
|
in
|
|
pkgs.writeShellScript "mautrix-facebook"
|
|
''
|
|
DATA_DIR="/var/lib/mautrix-facebook"
|
|
CONFIG_FILE="$DATA_DIR/config.yaml"
|
|
REGISTRATION_FILE="/var/lib/registrations/mautrix-facebook.yaml"
|
|
DB_FILE="$DATA_DIR/sqlite.db"
|
|
|
|
cp ${config} "$CONFIG_FILE" ; chmod 755 "$CONFIG_FILE"
|
|
${pkgs.sqlite}/bin/sqlite3 $DB_FILE '.databases ; .quit'
|
|
|
|
[ -e "$REGISTRATION_FILE" ] || \
|
|
${pkgs.mautrix-facebook}/bin/mautrix-facebook -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -g
|
|
${pkgs.mautrix-facebook}/bin/mautrix-facebook -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -n
|
|
'';
|
|
};
|
|
});
|
|
}
|