Unverified Commit 1f832ad5 authored by Robert Schütz's avatar Robert Schütz Committed by GitHub
Browse files

Merge pull request #254306 from dotlambda/tedicross-drop

nodePackages.tedicross: drop
parents 9eaa0e39 536969ca
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -1069,7 +1069,6 @@
  ./services/networking/tayga.nix
  ./services/networking/tcpcrypt.nix
  ./services/networking/teamspeak3.nix
  ./services/networking/tedicross.nix
  ./services/networking/teleport.nix
  ./services/networking/tetrd.nix
  ./services/networking/tftpd.nix
+3 −0
Original line number Diff line number Diff line
@@ -124,6 +124,9 @@ in
      See https://www.isc.org/blogs/isc-dhcp-eol/ for details.
      Please switch to a different implementation like kea or dnsmasq.
    '')
    (mkRemovedOptionModule [ "services" "tedicross" ] ''
      The corresponding package was broken and removed from nixpkgs.
    '')

    # Do NOT add any option renames here, see top of the file
  ];
+0 −100
Original line number Diff line number Diff line
{ config, pkgs, lib, ... }:

with lib;

let
  dataDir = "/var/lib/tedicross";
  cfg = config.services.tedicross;
  configJSON = pkgs.writeText "tedicross-settings.json" (builtins.toJSON cfg.config);
  configYAML = pkgs.runCommand "tedicross-settings.yaml" { preferLocalBuild = true; } ''
    ${pkgs.remarshal}/bin/json2yaml -i ${configJSON} -o $out
  '';

in {
  options = {
    services.tedicross = {
      enable = mkEnableOption (lib.mdDoc "the TediCross Telegram-Discord bridge service");

      config = mkOption {
        type = types.attrs;
        # from https://github.com/TediCross/TediCross/blob/master/example.settings.yaml
        example = literalExpression ''
          {
            telegram = {
              useFirstNameInsteadOfUsername = false;
              colonAfterSenderName = false;
              skipOldMessages = true;
              sendEmojiWithStickers = true;
            };
            discord = {
              useNickname = false;
              skipOldMessages = true;
              displayTelegramReplies = "embed";
              replyLength = 100;
            };
            bridges = [
              {
                name = "Default bridge";
                direction = "both";
                telegram = {
                  chatId = -123456789;
                  relayJoinMessages = true;
                  relayLeaveMessages = true;
                  sendUsernames = true;
                  ignoreCommands = true;
                };
                discord = {
                  serverId = "DISCORD_SERVER_ID";
                  channelId = "DISCORD_CHANNEL_ID";
                  relayJoinMessages = true;
                  relayLeaveMessages = true;
                  sendUsernames = true;
                  crossDeleteOnTelegram = true;
                };
              }
            ];

            debug = false;
          }
        '';
        description = lib.mdDoc ''
          {file}`settings.yaml` configuration as a Nix attribute set.
          Secret tokens should be specified using {option}`environmentFile`
          instead of this world-readable file.
        '';
      };

      environmentFile = mkOption {
        type = types.nullOr types.path;
        default = null;
        description = lib.mdDoc ''
          File containing environment variables to be passed to the TediCross service,
          in which secret tokens can be specified securely using the
          `TELEGRAM_BOT_TOKEN` and `DISCORD_BOT_TOKEN`
          keys.
        '';
      };
    };
  };

  config = mkIf cfg.enable {
    # from https://github.com/TediCross/TediCross/blob/master/guides/autostart/Linux.md
    systemd.services.tedicross = {
      description = "TediCross Telegram-Discord bridge service";
      wantedBy = [ "multi-user.target" ];
      wants = [ "network-online.target" ];
      after = [ "network-online.target" ];
      serviceConfig = {
        Type = "simple";
        ExecStart = "${pkgs.nodePackages.tedicross}/bin/tedicross --config='${configYAML}' --data-dir='${dataDir}'";
        Restart = "always";
        DynamicUser = true;
        StateDirectory = baseNameOf dataDir;
        EnvironmentFile = cfg.environmentFile;
      };
    };
  };

  meta.maintainers = with maintainers; [ pacien ];
}
+1 −0
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ mapAliases {
  inherit (pkgs) stylelint; # added 2023-09-13
  surge = pkgs.surge-cli; # Added 2023-09-08
  swagger = throw "swagger was removed because it was broken and abandoned upstream"; # added 2023-09-09
  tedicross = throw "tedicross was removed because it was broken"; # added 2023-09-09
  inherit (pkgs) terser; # Added 2023-08-31
  thelounge = pkgs.thelounge; # Added 2023-05-22
  three = throw "three was removed because it was no longer needed"; # Added 2023-09-08
+0 −1
Original line number Diff line number Diff line
@@ -237,7 +237,6 @@
, "svelte-language-server"
, "svgo"
, "tailwindcss"
, {"tedicross": "git+https://github.com/TediCross/TediCross.git#v0.8.7"}
, "teck-programmer"
, "tern"
, "textlint"
Loading