2023-11-18 16:00:30 +01:00
|
|
|
{
|
2024-03-02 22:05:30 +01:00
|
|
|
inputs,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: {
|
2023-11-18 16:00:30 +01:00
|
|
|
flake.nixngConfigurations.mautrixSlack = inputs.nixng.nglib.makeSystem {
|
|
|
|
system = "x86_64-linux";
|
|
|
|
name = "mautrix-slack";
|
|
|
|
inherit (inputs) nixpkgs;
|
2024-03-02 22:05:30 +01:00
|
|
|
config = {
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: {
|
|
|
|
dumb-init = {
|
|
|
|
enable = true;
|
|
|
|
type.services = {};
|
|
|
|
};
|
2023-11-18 16:00:30 +01:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
init.services.mautrix-slack = {
|
|
|
|
enabled = true;
|
|
|
|
shutdownOnExit = true;
|
|
|
|
script = let
|
|
|
|
inherit
|
|
|
|
(lib)
|
|
|
|
getExe'
|
|
|
|
makeBinPath
|
|
|
|
;
|
|
|
|
mautrix-slack = (pkgs.appendOverlays [config.flake.overlays.mautrix-slack]).mautrix-slack;
|
|
|
|
in
|
|
|
|
pkgs.writeShellScript "mautrix-slack"
|
|
|
|
''
|
|
|
|
DATA_DIR="/var/lib/mautrix-slack"
|
|
|
|
CONFIG_FILE="$DATA_DIR/config.yaml"
|
|
|
|
REGISTRATION_FILE="/var/lib/registrations/mautrix-slack.yaml"
|
2023-11-18 16:00:30 +01:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
${getExe' pkgs.envsubst "envsubst"} < ${./mautrix-slack.yaml} > "$CONFIG_FILE"
|
|
|
|
chmod 755 "$CONFIG_FILE"
|
2023-11-18 16:00:30 +01:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
export PATH="$PATH:${makeBinPath [pkgs.lottieconverter]};"
|
2023-11-18 16:00:30 +01:00
|
|
|
|
2024-03-02 22:05:30 +01:00
|
|
|
[ -e "$REGISTRATION_FILE" ] || \
|
|
|
|
${getExe' mautrix-slack "mautrix-slack"} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -g
|
|
|
|
${getExe' mautrix-slack "mautrix-slack"} -c "$CONFIG_FILE" -r "$REGISTRATION_FILE" -n
|
|
|
|
'';
|
2023-11-18 16:00:30 +01:00
|
|
|
};
|
2024-03-02 22:05:30 +01:00
|
|
|
};
|
2023-11-18 16:00:30 +01:00
|
|
|
};
|
|
|
|
}
|