2022-09-19 01:11:59 +02:00
|
|
|
{ nglib, nixpkgs }:
|
|
|
|
nglib.makeSystem {
|
|
|
|
system = "x86_64-linux";
|
2022-10-27 11:39:39 +02:00
|
|
|
name = "mautrix-facebook";
|
2022-09-19 01:11:59 +02:00
|
|
|
inherit nixpkgs;
|
|
|
|
config = ({ pkgs, ... }:
|
|
|
|
{
|
|
|
|
dumb-init = {
|
|
|
|
enable = true;
|
|
|
|
type.services = { };
|
|
|
|
};
|
|
|
|
|
|
|
|
init.services.mautrix-facebook = {
|
|
|
|
enabled = true;
|
|
|
|
shutdownOnExit = true;
|
|
|
|
script =
|
|
|
|
let
|
|
|
|
config = ./mautrix-facebook.yaml;
|
2023-05-13 22:09:22 +02:00
|
|
|
mautrix-facebook = pkgs.mautrix-facebook.overridePythonAttrs (old: {
|
|
|
|
propagatedBuildInputs = with pkgs.python3.pkgs; [
|
|
|
|
aiosqlite
|
|
|
|
] ++ old.propagatedBuildInputs;
|
|
|
|
});
|
2022-09-19 01:11:59 +02:00
|
|
|
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" ] || \
|
2023-05-13 22:09:22 +02:00
|
|
|
${mautrix-facebook}/bin/mautrix-facebook -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -g
|
|
|
|
${mautrix-facebook}/bin/mautrix-facebook -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -n
|
2022-09-19 01:11:59 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
});
|
|
|
|
}
|