mirror of
https://git.sr.ht/~magic_rb/cluster
synced 2024-11-22 00:04:20 +01:00
ecc73b5db2
Signed-off-by: Magic_RB <magic_rb@redalder.org>
54 lines
1.5 KiB
Nix
54 lines
1.5 KiB
Nix
{ nglib, nixpkgs }:
|
|
nglib.makeSystem {
|
|
system = "x86_64-linux";
|
|
name = "mautrix-signal";
|
|
inherit nixpkgs;
|
|
config = ({ pkgs, ... }:
|
|
{
|
|
dumb-init = {
|
|
enable = true;
|
|
type.services = { };
|
|
};
|
|
|
|
init.services.mautrix-signal = {
|
|
enabled = true;
|
|
shutdownOnExit = true;
|
|
script =
|
|
let
|
|
config = ./mautrix-signal.yaml;
|
|
inherit (pkgs) lib;
|
|
in
|
|
pkgs.writeShellScript "mautrix-signal"
|
|
''
|
|
DATA_DIR="/var/lib/mautrix-signal"
|
|
CONFIG_FILE="$DATA_DIR/config.yaml"
|
|
REGISTRATION_FILE="/var/lib/registrations/mautrix-signal.yaml"
|
|
DB_FILE="$DATA_DIR/sqlite.db"
|
|
|
|
cp ${config} "$CONFIG_FILE" ; chmod 755 "$CONFIG_FILE"
|
|
|
|
[ -e "$REGISTRATION_FILE" ] || \
|
|
${lib.getExe pkgs.mautrix-signal} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -g
|
|
${lib.getExe pkgs.mautrix-signal} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -n
|
|
'';
|
|
};
|
|
|
|
init.services.signald = {
|
|
enabled = true;
|
|
shutdownOnExit = true;
|
|
script =
|
|
let
|
|
inherit (pkgs) lib;
|
|
in
|
|
pkgs.writeShellScript "signald"
|
|
''
|
|
DATA_DIR="/var/lib/signald"
|
|
SOCKET_PATH="/var/run/signald/signald.sock"
|
|
mkdir -p $(dirname $SOCKET_PATH)
|
|
|
|
${lib.getExe pkgs.signald} -d $DATA_DIR -s $SOCKET_PATH
|
|
'';
|
|
};
|
|
});
|
|
}
|