dotfiles/nixng/containers/matrix/mautrix-signal/default.nix
magic_rb 801b59a8cf
Attempt to fix signal locale
Signed-off-by: magic_rb <richard@brezak.sk>
2023-10-18 15:41:00 +02:00

59 lines
1.8 KiB
Nix

{ inputs, ... }:
{
flake.nixngConfigurations.mautrixSignal = inputs.nixng.nglib.makeSystem {
system = "x86_64-linux";
name = "mautrix-signal";
inherit (inputs) nixpkgs;
config =
{ pkgs, lib, ... }:
{
dumb-init = {
enable = true;
type.services = { };
};
init.services.mautrix-signal = {
enabled = true;
shutdownOnExit = true;
script = 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 ${./mautrix-signal.yaml} "$CONFIG_FILE" ; chmod 755 "$CONFIG_FILE"
[ -e "$REGISTRATION_FILE" ] || \
${lib.getExe' pkgs.mautrix-signal "mautrix-signal"} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -g
${lib.getExe' pkgs.mautrix-signal "mautrix-signal"} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -n
'';
};
init.services.signald = {
enabled = true;
shutdownOnExit = true;
script =
let
locales =
[
"C.UTF-8"
"en_US.UTF-8"
];
i18n = pkgs.glibcLocales.override {
inherit locales;
};
in
pkgs.writeShellScript "signald" ''
DATA_DIR="/var/lib/signald"
SOCKET_PATH="/var/run/signald/signald.sock"
mkdir -p $(dirname $SOCKET_PATH)
export LANG=en_US.UTF-8
export LOCALE_ARCHIVE=${i18n}/lib/locale/locale-archive
${lib.getExe' pkgs.signald "signald"} -d $DATA_DIR -s $SOCKET_PATH
'';
};
};
};
}